当前位置: 首页>>代码示例>>PHP>>正文


PHP Service::getObjectsReferencingUser方法代码示例

本文整理汇总了PHP中Pimcore\Model\Object\Service::getObjectsReferencingUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::getObjectsReferencingUser方法的具体用法?PHP Service::getObjectsReferencingUser怎么用?PHP Service::getObjectsReferencingUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pimcore\Model\Object\Service的用法示例。


在下文中一共展示了Service::getObjectsReferencingUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAction

 public function getAction()
 {
     if (intval($this->getParam("id")) < 1) {
         $this->_helper->json(["success" => false]);
     }
     $user = User::getById(intval($this->getParam("id")));
     if ($user->isAdmin() && !$this->getUser()->isAdmin()) {
         throw new \Exception("Only admin users are allowed to modify admin users");
     }
     // workspaces
     $types = ["asset", "document", "object"];
     foreach ($types as $type) {
         $workspaces = $user->{"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();
             }
         }
     }
     // object <=> user dependencies
     $userObjects = Object\Service::getObjectsReferencingUser($user->getId());
     $userObjectData = [];
     foreach ($userObjects as $o) {
         $hasHidden = false;
         if ($o->isAllowed("list")) {
             $userObjectData[] = ["path" => $o->getRealFullPath(), "id" => $o->getId(), "subtype" => $o->getClass()->getName()];
         } else {
             $hasHidden = true;
         }
     }
     // get available permissions
     $availableUserPermissionsList = new User\Permission\Definition\Listing();
     $availableUserPermissions = $availableUserPermissionsList->load();
     // get available roles
     $roles = [];
     $list = new User\Role\Listing();
     $list->setCondition("`type` = ?", ["role"]);
     $list->load();
     $roles = [];
     if (is_array($list->getItems())) {
         foreach ($list->getItems() as $role) {
             $roles[] = [$role->getId(), $role->getName()];
         }
     }
     // unset confidential informations
     $userData = object2array($user);
     $contentLanguages = Tool\Admin::reorderWebsiteLanguages($user, Tool::getValidLanguages());
     $userData["contentLanguages"] = $contentLanguages;
     unset($userData["password"]);
     $availablePerspectives = \Pimcore\Config::getAvailablePerspectives(null);
     $conf = \Pimcore\Config::getSystemConfig();
     $this->_helper->json(["success" => true, "wsenabled" => $conf->webservice->enabled, "user" => $userData, "roles" => $roles, "permissions" => $user->generatePermissionList(), "availablePermissions" => $availableUserPermissions, "availablePerspectives" => $availablePerspectives, "objectDependencies" => ["hasHidden" => $hasHidden, "dependencies" => $userObjectData]]);
 }
开发者ID:solverat,项目名称:pimcore,代码行数:55,代码来源:UserController.php


注:本文中的Pimcore\Model\Object\Service::getObjectsReferencingUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。