Beispiel #1
0
 public function getAvailablePermissionsAction()
 {
     $list = User_Permission_List::getAllPermissionDefinitions();
     $this->_helper->json($list);
 }
Beispiel #2
0
 /**
  *
  * @return Array $permissionNames
  */
 public static function getAllPermissionDefinitions()
 {
     if (empty(self::$permissionNames)) {
         $list = new User_Permission_Definition_List();
         self::$permissionNames = $list->load();
     }
     return self::$permissionNames;
 }
Beispiel #3
0
 /**
  *
  * @param String $permissionName
  */
 public function setPermission($permissionName)
 {
     $availableUserPermissions = User_Permission_List::getAllPermissionDefinitions();
     $availableUserPermissionKeys = array();
     foreach ($availableUserPermissions as $permission) {
         if ($permission instanceof User_Permission_Definition) {
             $availableUserPermissionKeys[] = $permission->getKey();
         }
     }
     if (in_array($permissionName, $availableUserPermissionKeys)) {
         if (empty($this->permissions) or !in_array($permissionName, $this->permissions->getPermissionNames())) {
             $permission = new User_Permission($permissionName, false);
             $this->permissions->add($permission);
         }
     }
 }