예제 #1
0
파일: Acl.php 프로젝트: josmel/adminwap
 public function __construct()
 {
     $this->addRole(new Zend_Acl_Role(self::GUEST));
     $this->add(new Zend_Acl_Resource('admin::error::error'));
     $this->add(new Zend_Acl_Resource('admin::index::error404'));
     $this->add(new Zend_Acl_Resource('admin::index::index'));
     $this->add(new Zend_Acl_Resource('admin::index::login'));
     $this->add(new Zend_Acl_Resource('admin::index::logout'));
     $this->add(new Zend_Acl_Resource('landing::*'));
     $this->add(new Zend_Acl_Resource('office::*'));
     $this->add(new Zend_Acl_Resource('service::*'));
     $this->add(new Zend_Acl_Resource('challenge::*'));
     $this->add(new Zend_Acl_Resource('admin-challenge::*'));
     $this->allow(self::GUEST, 'admin::error::error');
     $this->allow(self::GUEST, 'admin::index::error404');
     $this->allow(self::GUEST, 'admin::index::index');
     $this->allow(self::GUEST, 'admin::index::login');
     $this->allow(self::GUEST, 'admin::index::logout');
     $this->allow(self::GUEST, 'landing::*');
     $this->allow(self::GUEST, 'office::*');
     $this->allow(self::GUEST, 'service::*');
     $this->allow(self::GUEST, 'challenge::*');
     $this->allow(self::GUEST, 'admin-challenge::*');
     $modelAcl = new Application_Model_Acl();
     $listAcl = $modelAcl->getListResources();
     foreach ($listAcl as $resource) {
         try {
             if (!$this->has($resource)) {
                 $this->add(new Zend_Acl_Resource($resource));
             }
         } catch (Exception $ex) {
         }
     }
     $modelRole = new Application_Model_Role();
     $roles = $modelRole->getAllRoles();
     foreach ($roles as $item) {
         try {
             $this->addRole(new Zend_Acl_Role($item['desrol']), self::GUEST);
             $aclsRole = $modelAcl->getAclByRole($item['idrol']);
             foreach ($aclsRole as $permission) {
                 $this->allow($item['desrol'], $permission);
             }
         } catch (Exception $ex) {
         }
     }
     //  $this->add(new Zend_Acl_Resource('admin::tipo-antecedentes'));
     //PERMISOS
 }
예제 #2
0
파일: Acl.php 프로젝트: josmel/movistar
 public function __construct()
 {
     $this->addRole(new Zend_Acl_Role(self::GUEST));
     $this->add(new Zend_Acl_Resource('admin::error::error-privilegio'));
     $this->add(new Zend_Acl_Resource('admin::index::error404'));
     $this->add(new Zend_Acl_Resource('admin::index::index'));
     $this->add(new Zend_Acl_Resource('admin::index::login'));
     $this->add(new Zend_Acl_Resource('admin::index::logout'));
     $this->add(new Zend_Acl_Resource('admin::dashboard::index'));
     $this->add(new Zend_Acl_Resource('admin::index::*'));
     $this->add(new Zend_Acl_Resource('preview::*'));
     $this->add(new Zend_Acl_Resource('service::server::soap'));
     $this->allow(self::GUEST, 'admin::error::error-privilegio');
     $this->allow(self::GUEST, 'admin::index::error404');
     $this->allow(self::GUEST, 'admin::index::index');
     $this->allow(self::GUEST, 'admin::index::login');
     $this->allow(self::GUEST, 'admin::index::logout');
     $this->allow(self::GUEST, 'admin::dashboard::index');
     $this->allow(self::GUEST, 'admin::index::*');
     $this->allow(self::GUEST, 'preview::*');
     $this->allow(self::GUEST, 'service::server::soap');
     $modelAcl = new Application_Model_Acl();
     $listAcl = $modelAcl->getListResources();
     foreach ($listAcl as $resource) {
         try {
             if (!$this->has($resource)) {
                 $this->add(new Zend_Acl_Resource($resource));
             }
         } catch (Exception $ex) {
         }
     }
     $modelRole = new Application_Model_Role();
     $roles = $modelRole->getAllRoles();
     foreach ($roles as $item) {
         try {
             $this->addRole(new Zend_Acl_Role($item['name']), self::GUEST);
             $aclsRole = $modelAcl->getAclByRole($item['idrol']);
             foreach ($aclsRole as $permission) {
                 $this->allow($item['name'], $permission);
             }
         } catch (Exception $ex) {
             echo $ex->getMessage();
             exit;
         }
     }
 }