本文整理匯總了PHP中CAccess::getNames方法的典型用法代碼示例。如果您正苦於以下問題:PHP CAccess::getNames方法的具體用法?PHP CAccess::getNames怎麽用?PHP CAccess::getNames使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CAccess
的用法示例。
在下文中一共展示了CAccess::getNames方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: processActionShowRightsDetail
protected function processActionShowRightsDetail()
{
$this->checkRequiredPostParams(array('objectId'));
if ($this->errorCollection->hasErrors()) {
$this->sendJsonErrorResponse();
}
/** @var \Bitrix\Disk\File|\Bitrix\Disk\Folder $object */
$object = BaseObject::loadById((int) $this->request->getPost('objectId'), array('STORAGE'));
if (!$object) {
$this->errorCollection->add(array(new Error(Loc::getMessage('DISK_FOLDER_LIST_ERROR_COULD_NOT_FIND_OBJECT'), self::ERROR_COULD_NOT_FIND_OBJECT)));
$this->sendJsonErrorResponse();
}
$rightsManager = Driver::getInstance()->getRightsManager();
$securityContext = $object->getStorage()->getCurrentUserSecurityContext();
if (!$object->canChangeRights($securityContext)) {
$this->sendJsonAccessDeniedResponse();
}
$rightsByAccessCode = array();
foreach ($rightsManager->getAllListNormalizeRights($object->getRealObject()) as $rightOnObject) {
if (empty($rightOnObject['NEGATIVE'])) {
$rightOnObject['TASK'] = $rightsManager->getTaskById($rightOnObject['TASK_ID']);
$rightsByAccessCode[$rightOnObject['ACCESS_CODE']][] = $rightOnObject;
}
}
$access = new CAccess();
$names = $access->getNames(array_keys($rightsByAccessCode));
$this->sendJsonSuccessResponse(array('rights' => $rightsByAccessCode, 'accessCodeNames' => $names));
}