Example #1
0
 public function load()
 {
     # change 'guests' to your user roles
     if (ACL::isAllowed('user', Route::getControllerName(), Route::getActionName()) == false) {
         throw new AccessNotAllowedException('You are not allowed to access this page');
     }
 }
Example #2
0
 public function load()
 {
     if (!empty($this->options)) {
         if (isset($this->only_actions[$this->action_name]) == false) {
             return;
         }
         if (isset($this->except_actions[$this->action_name])) {
             return;
         }
     }
     ACL::addResource(new Resource($this->controller_name), $this->action_name);
     if (!empty($this->obj->getAllowedRoles())) {
         foreach ($this->obj->getAllowedRoles() as $role) {
             ACL::allow($role, $this->controller_name, $this->action_name);
         }
     }
     if (!empty($this->obj->getDeniedRoles())) {
         foreach ($this->obj->getDeniedRoles() as $role) {
             ACL::deny($role, $this->controller_name, $this->action_name);
         }
     }
     $this->obj->load();
 }