Inheritance: extends Pimcore\Model\Listing\AbstractListing
示例#1
0
 /**
  * @param $permission
  * @return mixed
  * @throws \Exception
  */
 public static function getByKey($permission)
 {
     if (!$permission) {
         throw new \Exception("No permisson defined.");
     }
     $list = new Definition\Listing();
     $list->setCondition("`key`=?", [$permission]);
     $list->setLimit(1);
     $permissionDefinition = $list->load();
     if ($permissionDefinition[0]) {
         return $permissionDefinition[0];
     }
 }
示例#2
0
 public function roleGetAction()
 {
     $role = User\Role::getById(intval($this->getParam("id")));
     // workspaces
     $types = ["asset", "document", "object"];
     foreach ($types as $type) {
         $workspaces = $role->{"getWorkspaces" . ucfirst($type)}();
         foreach ($workspaces as $workspace) {
             $el = Element\Service::getElementById($type, $workspace->getCid());
             if ($el) {
                 // direct injection => not nice but in this case ok ;-)
                 $workspace->path = $el->getRealFullPath();
             }
         }
     }
     // get available permissions
     $availableUserPermissionsList = new User\Permission\Definition\Listing();
     $availableUserPermissions = $availableUserPermissionsList->load();
     $availablePerspectives = \Pimcore\Config::getAvailablePerspectives(null);
     $this->_helper->json(["success" => true, "role" => $role, "permissions" => $role->generatePermissionList(), "classes" => $role->getClasses(), "docTypes" => $role->getDocTypes(), "availablePermissions" => $availableUserPermissions, "availablePerspectives" => $availablePerspectives]);
 }
示例#3
0
 /**
  * Generates the permission list required for frontend display
  *
  * @return void
  */
 public function generatePermissionList()
 {
     $permissionInfo = null;
     $list = new Permission\Definition\Listing();
     $definitions = $list->load();
     foreach ($definitions as $definition) {
         $permissionInfo[$definition->getKey()] = $this->getPermission($definition->getKey());
     }
     return $permissionInfo;
 }