當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。