예제 #1
0
 /**
  * Initialize the ACL resource.
  *
  * Attempt to read application.ini and find out
  * where to get roles from: acl.ini or mongo.
  *
  * By default, get roles from mongo 'config' collection.
  */
 public function init()
 {
     // Get options from application.ini
     $options = $this->getOptions();
     if (!empty($options) && $options['location'] == 'ini') {
         $acl = App_Acl_Factory::createAclFromFile(APPLICATION_PATH . '/../data/acl/portal.ini');
     } else {
         $acl = new App_Acl();
     }
     // Deny everything by default
     $acl->deny();
     return $acl;
 }
예제 #2
0
 public function processConfigFile($conf, $ns, $save = true)
 {
     $acl = new App_Acl();
     // Deny everything by default
     $acl->deny();
     $this->_makeAcl($acl, $conf);
     $result = $this->flatAcl($acl, $ns);
     if ($save) {
         $this->saveToMongo($ns, $result['resources'], $result['permissions']);
     }
     if (isset($conf->removePermissions)) {
         $this->removePermissions($ns, $conf->removePermissions);
     }
     if (isset($conf->clone)) {
         $this->cloneRoles($conf->clone);
     }
     return $result;
 }