本文整理汇总了PHP中Acl::getResourceData方法的典型用法代码示例。如果您正苦于以下问题:PHP Acl::getResourceData方法的具体用法?PHP Acl::getResourceData怎么用?PHP Acl::getResourceData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Acl
的用法示例。
在下文中一共展示了Acl::getResourceData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canAccessPage
public function canAccessPage($id, $action)
{
$acl = Acl::getResourceData(Acl::RESOURCE_GROUP_PAGES, $id);
if ($acl !== false) {
return Acl::canAccess(Acl::RESOURCE_GROUP_PAGES, $id, $action);
} else {
$finished = false;
$ret = false;
$next_id = $id;
$safety_counter = 0;
do {
if ($next_id == Pages::ROOT_ID) {
$ret = Acl::canAccess(Acl::RESOURCE_GROUP_PAGES, Pages::ROOT_ID, $action);
$finished = true;
} else {
$res = $this->pages->getProperties($next_id);
if ($res !== false) {
$acl = Acl::getResourceData(Acl::RESOURCE_GROUP_PAGES, $next_id);
if ($acl !== false) {
$ret = Acl::canAccess(Acl::RESOURCE_GROUP_PAGES, $next_id, $action);
$finished = true;
}
$next_id = $res['parent-id'];
} else {
$finished = true;
}
}
$safety_counter++;
} while (!$finished && $safety_counter < 50);
return $ret;
}
}
示例2: createAclResourceForCustomBackendModule
public function createAclResourceForCustomBackendModule()
{
if ($this->is_custom_backend_module) {
$module = $this->custom_backend_module_data;
if (isset($module['aclResourceId'])) {
if (trim($module['aclResourceId']) != '') {
$resource = Acl::getResourceData(Acl::RESOURCE_GROUP_MODULES, $module['aclResourceId']);
if ($resource === false) {
Acl::registerResource(Acl::RESOURCE_GROUP_MODULES, $module['aclResourceId'], $module['name'], Acl::RESOURCE_USER_WHITELIST);
}
}
}
}
}
示例3: copyElements
protected function copyElements($elements, $dest_id, $position = null)
{
$counter = 0;
foreach ($elements as $element) {
if ($position !== null) {
$dest_position = $position + $counter;
} else {
$dest_position = null;
}
$result = $this->pages->copy($element['id'], $dest_id, $dest_position);
if ($result === false) {
return false;
}
$newId = $result;
$existing_acl_resource = Acl::getResourceData(Acl::RESOURCE_GROUP_PAGES, $element['id']);
if ($existing_acl_resource !== false) {
$new_acl_resource_id = Acl::registerResource(Acl::RESOURCE_GROUP_PAGES, $newId, $this->pages->getAnyCaption($result), $existing_acl_resource['user-groups-mode']);
$user_groups = Acl::getUserGroups(Acl::RESOURCE_GROUP_PAGES, $element['id']);
if ($user_groups !== false) {
Acl::assignUserGroupsById($new_acl_resource_id, $user_groups);
}
}
$children = $this->pages->getChildren($element['id'], false);
if ($children !== false) {
if (count($children) > 0) {
if ($this->copyElements($children, $newId) === false) {
return false;
}
}
}
$counter++;
}
return true;
}
示例4: editAction
public function editAction()
{
$pageId = Request::getParam('pageId', -1);
if (is_array($pageId)) {
$containsSubpages = false;
if (count($pageId) > 0) {
foreach ($pageId as $id) {
$properties = $this->pages->getProperties($id);
if ($properties === false) {
$this->doesNotExist();
return;
}
if (!$this->helpers->canAccessPage($id, Acl::ACTION_EDIT)) {
$this->accessDenied();
return;
}
$children = $this->pages->getChildren($id, false);
if ($children !== false) {
if (count($children) > 0) {
$containsSubpages = true;
break;
}
}
}
}
$this->view->assign('batchEdit', true);
$this->view->assign('pageIdList', $pageId);
$caption = array();
$alias = array();
$visibility = array();
$translated_link_urls = array();
$languages = Config::get()->languages->list;
foreach ($languages as $key => $language) {
$caption[$key] = '';
$alias[$key] = '';
$visibility[$key] = 0;
$translated_link_urls[$key] = '';
}
$properties = array('visibility' => Pages::VISIBILITY_ALWAYS, 'active' => 1, 'cachable' => 1, 'translated-link-url' => $translated_link_url);
$aclResource = array('group' => Acl::RESOURCE_GROUP_PAGES, 'resource-id' => null, 'description' => null, 'user-groups-mode' => Acl::RESOURCE_SUPERUSER_ONLY);
$aclUserGroups = array();
$this->view->assign('action', 'edit');
$this->view->assign('caption', $caption);
$this->view->assign('alias', $alias);
$this->view->assign('visibility', $visibility);
$this->view->assign('translatedLinkUrls', $translated_link_urls);
$this->view->assign('properties', $properties);
$this->view->assign('inheritAcl', true);
$this->view->assign('aclResource', $aclResource);
$this->view->assign('aclUserGroups', $aclUserGroups);
$this->view->assign('containsSubpages', $containsSubpages);
} else {
if ($pageId > -1) {
$properties = $this->pages->getProperties($pageId);
if ($properties === false) {
$this->doesNotExist();
return;
}
if (!$this->helpers->canAccessPage($pageId, Acl::ACTION_EDIT)) {
$this->accessDenied();
return;
}
$this->view->assign('action', 'edit');
$this->view->assign('batchEdit', false);
$this->view->assign('pageId', $pageId);
$this->view->assign('caption', $this->pages->getCaption($pageId));
$this->view->assign('alias', $this->pages->getPageAliases($pageId));
$this->view->assign('visibility', $this->pages->getVisibility($pageId));
$this->view->assign('translatedLinkUrls', $this->pages->getTranslatedLinkUrls($pageId));
$this->view->assign('properties', $properties);
$aclResource = Acl::getResourceData(Acl::RESOURCE_GROUP_PAGES, $pageId);
if ($aclResource === false) {
$this->view->assign('inheritAcl', true);
$aclResource = array('group' => Acl::RESOURCE_GROUP_PAGES, 'resource-id' => null, 'description' => null, 'user-groups-mode' => Acl::RESOURCE_SUPERUSER_ONLY);
$aclUserGroups = array();
} else {
$this->view->assign('inheritAcl', false);
$aclUserGroups = Acl::getUserGroups(Acl::RESOURCE_GROUP_PAGES, $pageId);
}
$this->view->assign('aclResource', $aclResource);
$this->view->assign('aclUserGroups', $aclUserGroups);
$containsSubpages = false;
$children = $this->pages->getChildren($pageId, false);
if ($children !== false) {
if (count($children) > 0) {
$containsSubpages = true;
}
}
$this->view->assign('containsSubpages', $containsSubpages);
} else {
$this->createAction();
}
}
}