当前位置: 首页>>代码示例>>PHP>>正文


PHP PermissionKey::getByHandle方法代码示例

本文整理汇总了PHP中PermissionKey::getByHandle方法的典型用法代码示例。如果您正苦于以下问题:PHP PermissionKey::getByHandle方法的具体用法?PHP PermissionKey::getByHandle怎么用?PHP PermissionKey::getByHandle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PermissionKey的用法示例。


在下文中一共展示了PermissionKey::getByHandle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __call

 /** 
  * We take any permissions function run on the permissions class and send it into the category
  * object
  */
 public function __call($f, $a)
 {
     if (!is_object($this->response)) {
         // handles task permissions
         $permission = Loader::helper('text')->uncamelcase($f);
     }
     if (count($a) > 0) {
         if (is_object($this->response)) {
             $r = call_user_func_array(array($this->response, $f), $a);
         } else {
             $pk = PermissionKey::getByHandle($permission);
             $r = call_user_func_array(array($pk, $f), $a);
         }
     } else {
         if (is_object($this->response)) {
             $r = $this->response->{$f}();
         } else {
             $pk = PermissionKey::getByHandle($permission);
             if (is_object($pk)) {
                 $r = $pk->validate();
             } else {
                 throw new Exception(t('Unable to get permission key for %s', $permission));
             }
         }
     }
     if (is_array($r) || is_object($r)) {
         return $r;
     } else {
         if ($r) {
             return 1;
         } else {
             return 0;
         }
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:39,代码来源:permissions.php

示例2: getPermissionAccessObject

 public function getPermissionAccessObject()
 {
     $db = Loader::db();
     if ($this->permissionObjectToCheck instanceof Area) {
         $r = $db->GetOne('select paID from AreaPermissionAssignments where cID = ? and arHandle = ? and pkID = ? ' . $filterString, array($this->permissionObjectToCheck->getCollectionID(), $this->permissionObjectToCheck->getAreaHandle(), $this->pk->getPermissionKeyID()));
         if ($r) {
             return PermissionAccess::getByID($r, $this->pk, false);
         }
     } else {
         if (isset($this->inheritedPermissions[$this->pk->getPermissionKeyHandle()])) {
             // this is a page
             $pk = PermissionKey::getByHandle($this->inheritedPermissions[$this->pk->getPermissionKeyHandle()]);
             $pk->setPermissionObject($this->permissionObjectToCheck);
             $pae = $pk->getPermissionAccessObject();
             return $pae;
         } else {
             if (isset($this->blockTypeInheritedPermissions[$this->pk->getPermissionKeyHandle()])) {
                 $pk = PermissionKey::getByHandle($this->blockTypeInheritedPermissions[$this->pk->getPermissionKeyHandle()]);
                 $pae = $pk->getPermissionAccessObject();
                 return $pae;
             }
         }
     }
     return false;
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:25,代码来源:area.php

示例3: run

	/** Executes the job.
	* @return string Returns a string describing the job result in case of success.
	* @throws Exception Throws an exception in case of errors.
	*/
	public function run() {
		Cache::disableCache();
		Cache::disableLocalCache();
		
		try {
			$db = Loader::db();
			$instances = array(
				'navigation' => Loader::helper('navigation'),
				'dashboard' => Loader::helper('concrete/dashboard'),
				'view_page' => PermissionKey::getByHandle('view_page')
			);
			$rsPages = $db->query('SELECT cID FROM Pages WHERE (cID > 1) ORDER BY cID');
			$relName = ltrim(SITEMAPXML_FILE, '\\/');
			$osName = rtrim(DIR_BASE, '\\/') . '/' . $relName;
			$urlName = rtrim(BASE_URL . DIR_REL, '\\/') . '/' . $relName;
			if(!file_exists($osName)) {
				@touch($osName);
			}
			if(!is_writable($osName)) {
				throw new Exception(t('The file %s is not writable', $osName));
			}
			if(!$hFile = fopen($osName, 'w')) {
				throw new Exception(t('Cannot open file %s', $osName));
			}
			if(!@fprintf($hFile, '<?xml version="1.0" encoding="%s"?>' . self::EOL . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">', APP_CHARSET)) {
				throw new Exception(t('Error writing header of %s', $osName));
			}
			$addedPages = 0;
			if(self::AddPage($hFile, 1, $instances)) {
				$addedPages++;
			}
			while($rowPage = $rsPages->FetchRow()) {
				if(self::AddPage($hFile, intval($rowPage['cID']), $instances)) {
					$addedPages++;
				}
			}
			$rsPages->Close();
			unset($rsPages);
			if(!@fwrite($hFile, self::EOL . '</urlset>')) {
				throw new Exception(t('Error writing footer of %s', $osName));
			}
			@fflush($hFile);
			@fclose($hFile);
			unset($hFile);
			return t('%1$s file saved (%2$d pages).', $urlName, $addedPages);
		}
		catch(Exception $x) {
			if(isset($rsPages) && $rsPages) {
				$rsPages->Close();
				$rsPages = null;
			}
			if(isset($hFile) && $hFile) {
				@fflush($hFile);
				@ftruncate($hFile, 0);
				@fclose($hFile);
				$hFile = null;
			}
			throw $x;
		}
	}
开发者ID:nveid,项目名称:concrete5,代码行数:64,代码来源:generate_sitemap.php

示例4: getPermissionAccessObject

 public function getPermissionAccessObject()
 {
     $db = Loader::db();
     if ($this->permissionObjectToCheck instanceof Block) {
         $co = $this->permissionObjectToCheck->getBlockCollectionObject();
         $arHandle = $this->permissionObjectToCheck->getAreaHandle();
         $paID = $db->GetOne('select paID from BlockPermissionAssignments where cID = ? and cvID = ? and bID = ? and pkID = ? ' . $filterString, array($co->getCollectionID(), $co->getVersionID(), $this->permissionObject->getBlockID(), $this->pk->getPermissionKeyID()));
         if ($paID) {
             $pae = PermissionAccess::getByID($paID, $this->pk, false);
         }
     } else {
         if ($this->permissionObjectToCheck instanceof Area && isset($this->inheritedAreaPermissions[$this->pk->getPermissionKeyHandle()])) {
             $pk = PermissionKey::getByHandle($this->inheritedAreaPermissions[$this->pk->getPermissionKeyHandle()]);
             $pk->setPermissionObject($this->permissionObjectToCheck);
             $pae = $pk->getPermissionAccessObject();
         } else {
             if ($this->permissionObjectToCheck instanceof Page && isset($this->inheritedPagePermissions[$this->pk->getPermissionKeyHandle()])) {
                 $pk = PermissionKey::getByHandle($this->inheritedPagePermissions[$this->pk->getPermissionKeyHandle()]);
                 $pk->setPermissionObject($this->permissionObjectToCheck);
                 $pae = $pk->getPermissionAccessObject();
             }
         }
     }
     return $pae;
 }
开发者ID:Mihail9575,项目名称:concrete5,代码行数:25,代码来源:block.php

示例5: remove_tree

 public function remove_tree()
 {
     if ($this->token->validate('remove_tree')) {
         $tree = Tree::getByID(Loader::helper('security')->sanitizeInt($_REQUEST['treeID']));
         $treeType = $tree->getTreeTypeObject();
         if (is_object($treeType)) {
             $treeTypeHandle = $treeType->getTreeTypeHandle();
         }
         if (is_object($tree) && $treeTypeHandle == 'topic') {
             if (\PermissionKey::getByHandle('remove_topic_tree')->validate()) {
                 $tree->delete();
                 $this->redirect('/dashboard/system/attributes/topics', 'tree_deleted');
             }
         }
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:16,代码来源:topics.php

示例6: run

 /** Executes the job.
  * @return string Returns a string describing the job result in case of success.
  * @throws Exception Throws an exception in case of errors.
  */
 public function run()
 {
     Cache::disableCache();
     Cache::disableLocalCache();
     try {
         $db = Loader::db();
         $instances = array('navigation' => Loader::helper('navigation'), 'dashboard' => Loader::helper('concrete/dashboard'), 'view_page' => PermissionKey::getByHandle('view_page'), 'guestGroup' => Group::getByID(GUEST_GROUP_ID), 'now' => new DateTime('now'), 'ak_exclude_sitemapxml' => CollectionAttributeKey::getByHandle('exclude_sitemapxml'), 'ak_sitemap_changefreq' => CollectionAttributeKey::getByHandle('sitemap_changefreq'), 'ak_sitemap_priority' => CollectionAttributeKey::getByHandle('sitemap_priority'));
         $instances['guestGroupAE'] = array(GroupPermissionAccessEntity::getOrCreate($instances['guestGroup']));
         $xmlDoc = new SimpleXMLElement('<' . '?xml version="1.0" encoding="' . APP_CHARSET . '"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />');
         $rs = Loader::db()->Query('SELECT cID FROM Pages');
         while ($row = $rs->FetchRow()) {
             self::addPage($xmlDoc, intval($row['cID']), $instances);
         }
         $rs->Close();
         Events::fire('on_sitemap_xml_ready', $xmlDoc);
         $dom = dom_import_simplexml($xmlDoc)->ownerDocument;
         $dom->formatOutput = true;
         $addedPages = count($xmlDoc->url);
         $relName = ltrim(SITEMAPXML_FILE, '\\/');
         $osName = rtrim(DIR_BASE, '\\/') . '/' . $relName;
         $urlName = rtrim(BASE_URL . DIR_REL, '\\/') . '/' . $relName;
         if (!file_exists($osName)) {
             @touch($osName);
         }
         if (!is_writable($osName)) {
             throw new Exception(t('The file %s is not writable', $osName));
         }
         if (!($hFile = @fopen($osName, 'w'))) {
             throw new Exception(t('Cannot open file %s', $osName));
         }
         if (!@fwrite($hFile, $dom->saveXML())) {
             throw new Exception(t('Error writing to file %s', $osName));
         }
         @fflush($hFile);
         @fclose($hFile);
         unset($hFile);
         return t('%1$s file saved (%2$d pages).', sprintf('<a href="%s" target="_blank">%s</a>', $urlName, preg_replace('/^https?:\\/\\//i', '', $urlName)), $addedPages);
     } catch (Exception $x) {
         if (isset($hFile) && $hFile) {
             @fflush($hFile);
             @ftruncate($hFile, 0);
             @fclose($hFile);
             $hFile = null;
         }
         throw $x;
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:51,代码来源:generate_sitemap.php

示例7: canGuestsViewThisBlock

 public function canGuestsViewThisBlock()
 {
     $pk = PermissionKey::getByHandle('view_block');
     $pk->setPermissionObject($this->getPermissionObject());
     $gg = GroupPermissionAccessEntity::getOrCreate(Group::getByID(GUEST_GROUP_ID));
     $accessEntities = array($gg);
     $valid = false;
     $list = $pk->getAccessListItems(PermissionKey::ACCESS_TYPE_ALL, $accessEntities);
     foreach ($list as $l) {
         if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_INCLUDE) {
             $valid = true;
         }
         if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_EXCLUDE) {
             $valid = false;
         }
     }
     return $valid;
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:18,代码来源:block.php

示例8: run

	public function run() {
		$j = Job::getByHandle('index_search_all');
		if (!is_object($j)) {
			Job::installByHandle('index_search_all');
		}

		$js = JobSet::getByName('Default');
		if (!is_object($js)) {
			$js = JobSet::add('Default');
		}
		$js->clearJobs();
		$jobs = Job::getList();
		foreach($jobs as $j) {
			if (!$j->supportsQueue()) {
				$js->addJob($j);	
			}
		}

		// create the view page in sitemap permission
		$rpk = PermissionKey::getByHandle('view_page');
		$vpk = PermissionKey::getByHandle('view_page_in_sitemap');
		if (!is_object($vpk)) {
			$vpk = PermissionKey::add('page', 'view_page_in_sitemap', 'View Page in Sitemap', 'View Page in Sitemap and Intelligent Search.', false, false);
		}
		// now we have to get a list of all pages in the site that have their own permissions set.
		$db = Loader::db();
		$r = $db->Execute('select cID from Pages where cInheritPermissionsFrom = "OVERRIDE" order by cID asc');
		while ($row = $r->Fetchrow()) {
			$c = Page::getByID($row['cID']);
			if (is_object($c) && !$c->isError()) {
				$rpk->setPermissionObject($c);
				$vpk->setPermissionObject($c);
				$rpa = $rpk->getPermissionAccessObject();
				if (is_object($rpa)) {
					$pt = $vpk->getPermissionAssignmentObject();
					if (is_object($pt)) {
						$pt->clearPermissionAssignment();
						$pt->assignPermissionAccess($rpa);						
					}
				}
			}
		}
	}
开发者ID:ronlobo,项目名称:concrete5,代码行数:43,代码来源:version_562.php

示例9: run

 public function run()
 {
     $bt = BlockType::getByHandle('guestbook');
     if (is_object($bt)) {
         $bt->refresh();
     }
     // add user export users task permission
     $pk = PermissionKey::getByHandle('access_user_search_export');
     if (!$pk instanceof PermissionKey) {
         $pk = PermissionKey::add('user', 'access_user_search_export', 'Export Site Users', 'Controls whether a user can export site users or not', false, false);
         $pa = $pk->getPermissionAccessObject();
         if (!is_object($pa)) {
             $pa = PermissionAccess::create($pk);
         }
         $adminGroup = Group::getByID(ADMIN_GROUP_ID);
         //Make sure "Adminstrators" group still exists
         if ($adminGroup) {
             $adminGroupEntity = GroupPermissionAccessEntity::getOrCreate($adminGroup);
             $pa->addListItem($adminGroupEntity);
             $pt = $pk->getPermissionAssignmentObject();
             $pt->assignPermissionAccess($pa);
         }
     }
     if (!Config::get('SECURITY_TOKEN_JOBS')) {
         Config::save('SECURITY_TOKEN_JOBS', Loader::helper('validation/identifier')->getString(64));
     }
     if (!Config::get('SECURITY_TOKEN_ENCRYPTION')) {
         Config::save('SECURITY_TOKEN_ENCRYPTION', Loader::helper('validation/identifier')->getString(64));
     }
     if (!Config::get('SECURITY_TOKEN_VALIDATION')) {
         Config::save('SECURITY_TOKEN_VALIDATION', Loader::helper('validation/identifier')->getString(64));
     }
     $sp = Page::getByPath('/dashboard/system/mail/method/test_settings');
     if (!is_object($sp) || $sp->isError()) {
         $sp = SinglePage::add('/dashboard/system/mail/method/test_settings');
         $sp->update(array('cName' => t('Test Mail Settings')));
         $sp->setAttribute('meta_keywords', 'test smtp, test mail');
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:39,代码来源:version_563.php

示例10: installPermissionsAndWorkflow

 protected function installPermissionsAndWorkflow()
 {
     $sx = simplexml_load_file(DIR_BASE_CORE . '/config/install/base/permissions.xml');
     foreach ($sx->permissioncategories->category as $pkc) {
         $handle = (string) $pkc['handle'];
         $pkca = PermissionKeyCategory::getByHandle($handle);
         if (!is_object($pkca)) {
             $pkx = PermissionKeyCategory::add((string) $pkc['handle']);
         }
     }
     foreach ($sx->workflowprogresscategories->category as $pkc) {
         $handle = (string) $pkc['handle'];
         $pkca = WorkflowProgressCategory::getByHandle($handle);
         if (!is_object($pkca)) {
             $pkx = WorkflowProgressCategory::add((string) $pkc['handle']);
         }
     }
     foreach ($sx->workflowtypes->workflowtype as $wt) {
         $handle = (string) $wt['handle'];
         $name = (string) $wt['name'];
         $wtt = WorkflowType::getByHandle($handle);
         if (!is_object($wtt)) {
             $pkx = WorkflowType::add($handle, $name);
         }
     }
     if (isset($sx->permissionaccessentitytypes)) {
         foreach ($sx->permissionaccessentitytypes->permissionaccessentitytype as $pt) {
             $name = $pt['name'];
             if (!$name) {
                 $name = Loader::helper('text')->unhandle($pt['handle']);
             }
             $handle = (string) $pt['handle'];
             $patt = PermissionAccessEntityType::getByHandle($handle);
             if (!is_object($patt)) {
                 $type = PermissionAccessEntityType::add((string) $pt['handle'], $name);
                 if (isset($pt->categories)) {
                     foreach ($pt->categories->children() as $cat) {
                         $catobj = PermissionKeyCategory::getByHandle((string) $cat['handle']);
                         $catobj->associateAccessEntityType($type);
                     }
                 }
             }
         }
     }
     $txt = Loader::helper('text');
     foreach ($sx->permissionkeys->permissionkey as $pk) {
         $pkc = PermissionKeyCategory::getByHandle((string) $pk['category']);
         $className = $txt->camelcase($pkc->getPermissionKeyCategoryHandle());
         $c1 = $className . 'PermissionKey';
         $handle = (string) $pk['handle'];
         $pka = PermissionKey::getByHandle($handle);
         if (!is_object($pka)) {
             $pkx = call_user_func(array($c1, 'import'), $pk);
         }
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:56,代码来源:version_560.php

示例11: assignPermissions

 public function assignPermissions($userOrGroup, $permissions = array(), $accessType = FileSetPermissionKey::ACCESS_TYPE_INCLUDE)
 {
     $db = Loader::db();
     if ($this->fsID > 0) {
         $db->Execute("update FileSets set fsOverrideGlobalPermissions = 1 where fsID = ?", array($this->fsID));
         $this->fsOverrideGlobalPermissions = true;
     }
     if (is_array($userOrGroup)) {
         $pe = GroupCombinationPermissionAccessEntity::getOrCreate($userOrGroup);
         // group combination
     } else {
         if ($userOrGroup instanceof User || $userOrGroup instanceof UserInfo) {
             $pe = UserPermissionAccessEntity::getOrCreate($userOrGroup);
         } else {
             // group;
             $pe = GroupPermissionAccessEntity::getOrCreate($userOrGroup);
         }
     }
     foreach ($permissions as $pkHandle) {
         $pk = PermissionKey::getByHandle($pkHandle);
         $pk->setPermissionObject($this);
         $pa = $pk->getPermissionAccessObject();
         if (!is_object($pa)) {
             $pa = PermissionAccess::create($pk);
         } else {
             if ($pa->isPermissionAccessInUse()) {
                 $pa = $pa->duplicate();
             }
         }
         $pa->addListItem($pe, false, $accessType);
         $pt = $pk->getPermissionAssignmentObject();
         $pt->assignPermissionAccess($pa);
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:34,代码来源:file_set.php

示例12: defined

<?php

defined('C5_EXECUTE') or die("Access Denied.");
$form = Loader::helper('form');
$tp = new TaskPermission();
Loader::model('attribute/categories/user');
$attribs = UserAttributeKey::getEditableList();
$sk = PermissionKey::getByHandle('access_user_search');
$ek = PermissionKey::getByHandle('edit_user_properties');
$tp = new TaskPermission();
if (!$tp->canEditUserProperties()) {
    die(t("Access Denied."));
}
$users = array();
if (is_array($_REQUEST['uID'])) {
    foreach ($_REQUEST['uID'] as $uID) {
        $ui = UserInfo::getByID($uID);
        $users[] = $ui;
    }
}
foreach ($users as $ui) {
    if (!$sk->validate($ui)) {
        die(t("Access Denied."));
    }
}
if ($_POST['task'] == 'update_extended_attribute') {
    $fakID = $_REQUEST['fakID'];
    $value = '';
    $ak = UserAttributeKey::get($fakID);
    foreach ($users as $ui) {
        if ($ek->validate($ak)) {
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:31,代码来源:bulk_properties.php

示例13: defined

<?php

defined('C5_EXECUTE') or die("Access Denied.");
$c = $b->getBlockCollectionObject();
$arHandle = $b->getAreaHandle();
use Concrete\Core\Permission\Duration as PermissionDuration;
$pk = PermissionKey::getByHandle('view_block');
$pk->setPermissionObject($b);
$list = $pk->getAccessListItems();
foreach ($list as $pa) {
    $pae = $pa->getAccessEntityObject();
    if ($pae->getAccessEntityTypeHandle() == 'group') {
        if ($pae->getGroupObject()->getGroupID() == GUEST_GROUP_ID) {
            $pd = $pa->getPermissionDurationObject();
            if (!is_object($pd)) {
                $pd = new PermissionDuration();
            }
        }
    }
}
?>
<div class="ccm-ui" id="ccm-permissions-access-entity-wrapper">
<form id="ccm-permissions-timed-guest-access-form" class="form-stacked" method="post" action="<?php 
echo REL_DIR_FILES_TOOLS_REQUIRED;
?>
/permissions/categories/block">
<input type="hidden" name="task" value="set_timed_guest_access" />
<?php 
echo Loader::helper('validation/token')->output('set_timed_guest_access');
?>
<input type="hidden" name="cID" value="<?php 
开发者ID:ceko,项目名称:concrete5-1,代码行数:31,代码来源:timed_guest_access.php

示例14: defined

<?php

defined('C5_EXECUTE') or die("Access Denied.");
$app = Concrete\Core\Support\Facade\Application::getFacadeApplication();
$form = $app->make('helper/form');
$ek = PermissionKey::getByHandle('edit_user_properties');
$ik = PermissionKey::getByHandle('activate_user');
$dk = PermissionKey::getByHandle('delete_user');
?>

<script type="text/template" data-template="search-results-table-body">
<% _.each(items, function (user) {%>
	<tr>
		<td><span class="ccm-search-results-checkbox"><input type="checkbox" class="ccm-flat-checkbox" data-user-id="<%-user.uID%>" data-user-name="<%-user.uName%>" data-user-email="<%-user.uEmail%>" data-search-checkbox="individual" value="<%-user.uID%>" /></span></td>
		<% for (i = 0; i < user.columns.length; i++) {
			var column = user.columns[i];
			%>
			<td><%= column.value %></td>
		<% } %>
	</tr>
<% }); %>
</script>

<div data-search-element="wrapper"></div>

<div data-search-element="results">

	<table border="0" cellspacing="0" cellpadding="0" class="ccm-search-results-table">
		<thead>
		</thead>
		<tbody>
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:31,代码来源:search.php

示例15: t

">

<h5><?php 
echo t('Version Comments');
?>
</h5>

<div class="ccm-panel-check-in-comments"><textarea name="comments" id="ccm-check-in-comments" /></textarea></div>

<?php 
if ($cp->canApprovePageVersions()) {
    if ($c->isPageDraft()) {
        $publishTitle = t('Publish Page');
    } else {
        $publishTitle = t('Publish Changes');
        $pk = PermissionKey::getByHandle('approve_page_versions');
        $pk->setPermissionObject($c);
        $pa = $pk->getPermissionAccessObject();
        $workflows = array();
        $canApproveWorkflow = true;
        if (is_object($pa)) {
            $workflows = $pa->getWorkflows();
        }
        foreach ($workflows as $wf) {
            if (!$wf->canApproveWorkflow()) {
                $canApproveWorkflow = false;
            }
        }
        if (count($workflows) > 0 && !$canApproveWorkflow) {
            $publishTitle = t('Submit to Workflow');
        }
开发者ID:digideskio,项目名称:concrete5,代码行数:31,代码来源:check_in.php


注:本文中的PermissionKey::getByHandle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。