getAvailablePerspectives() public static method

Returns a list of available perspectives for the given user
public static getAvailablePerspectives ( User $user ) : array
$user Pimcore\Model\User
return array
Exemplo n.º 1
0
 /**
  * Returns the first perspective name
  *
  * @return string
  */
 public function getFirstAllowedPerspective()
 {
     $perspectives = $this->getMergedPerspectives();
     if (!empty($perspectives)) {
         return $perspectives[0];
     } else {
         // all perspectives are allowed
         $perspectives = \Pimcore\Config::getAvailablePerspectives($this);
         return $perspectives[0]["name"];
     }
 }
Exemplo n.º 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]);
 }
Exemplo n.º 3
0
?>
,
        videoconverter: <?php 
echo \Zend_Json::encode(\Pimcore\Video::isAvailable());
?>
,
        asset_hide_edit: <?php 
echo $this->config->assets->hide_edit_image ? "true" : "false";
?>
,
        perspective: <?php 
echo \Zend_Json::encode($runtimePerspective);
?>
,
        availablePerspectives: <?php 
echo \Zend_Json::encode(\Pimcore\Config::getAvailablePerspectives(\Pimcore\Tool\Admin::getCurrentUser()));
?>
,
        customviews: <?php 
echo \Zend_Json::encode($this->customview_config);
?>
,
        disabledPortlets: <?php 
echo \Zend_Json::encode((new \Pimcore\Helper\Dashboard(\Pimcore\Tool\Admin::getCurrentUser()))->getDisabledPortlets());
?>
    };
</script>


<?php 
// 3rd party libraries