本文整理汇总了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]]);
}