本文整理汇总了PHP中Pimcore\Model\Object\Concrete::getPermissions方法的典型用法代码示例。如果您正苦于以下问题:PHP Concrete::getPermissions方法的具体用法?PHP Concrete::getPermissions怎么用?PHP Concrete::getPermissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Model\Object\Concrete
的用法示例。
在下文中一共展示了Concrete::getPermissions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValidLayouts
/**
* @param Concrete $object
* @return array
*/
public static function getValidLayouts(Concrete $object)
{
$user = AdminTool::getCurrentUser();
$resultList = array();
$isMasterAllowed = $user->getAdmin();
$permissionSet = $object->getPermissions("layouts", $user);
$layoutPermissions = self::getLayoutPermissions($object->getClassId(), $permissionSet);
if (!$layoutPermissions || isset($layoutPermissions[0])) {
$isMasterAllowed = true;
}
if ($user->getAdmin()) {
$superLayout = new ClassDefinition\CustomLayout();
$superLayout->setId(-1);
$superLayout->setName("Master (Admin Mode)");
$resultList[-1] = $superLayout;
}
if ($isMasterAllowed) {
$master = new ClassDefinition\CustomLayout();
$master->setId(0);
$master->setName("Master");
$resultList[0] = $master;
}
$classId = $object->getClassId();
$list = new ClassDefinition\CustomLayout\Listing();
$list->setOrderKey("name");
$condition = "classId = " . $list->quote($classId);
if (count($layoutPermissions) && !$isMasterAllowed) {
$layoutIds = array_values($layoutPermissions);
$condition .= " AND id IN (" . implode(",", $layoutIds) . ")";
}
$list->setCondition($condition);
$list = $list->load();
if (!count($resultList) && !count($list) || count($resultList) == 1 && !count($list)) {
return array();
}
foreach ($list as $customLayout) {
$resultList[$customLayout->getId()] = $customLayout;
}
return $resultList;
}