Exemplo n.º 1
0
 public function _initAcl()
 {
     $this->_initNavigation();
     $acl = new Zend_Acl();
     $acl->addRole(new Zend_Acl_Role('guest'))->addRole(new Zend_Acl_Role('user'))->addRole(new Zend_Acl_Role('admin'))->add(new Zend_Acl_Resource('add'))->add(new Zend_Acl_Resource('edit'))->add(new Zend_Acl_Resource('delete'))->add(new Zend_Acl_Resource('view'))->add(new Zend_Acl_Resource('addToMboard'))->allow('admin', array('view', 'add', 'edit', 'delete'))->allow('guest', array('view', 'addToMboard'))->allow('user', 'view');
     Controller_Plugin_AclIntegration::setNavigation(Zend_Registry::get('nav'));
     Controller_Plugin_AclIntegration::setDefaultPrivilege('view');
     Controller_Plugin_AclIntegration::setAcl($acl);
     if (Zend_Auth::getInstance()->hasIdentity()) {
         $data = Zend_Auth::getInstance()->getStorage()->read();
         Controller_Plugin_AclIntegration::setRole($data['group_id'] == 5 ? 'admin' : 'user');
     } else {
         Controller_Plugin_AclIntegration::setRole('guest');
     }
     Zend_Controller_Front::getInstance()->registerPlugin(new Controller_Plugin_AclIntegration());
 }
Exemplo n.º 2
0
 public static function setRole($role)
 {
     self::$_role = $role;
 }