本文整理汇总了PHP中owa_coreAPI::isEveryoneCapable方法的典型用法代码示例。如果您正苦于以下问题:PHP owa_coreAPI::isEveryoneCapable方法的具体用法?PHP owa_coreAPI::isEveryoneCapable怎么用?PHP owa_coreAPI::isEveryoneCapable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类owa_coreAPI
的用法示例。
在下文中一共展示了owa_coreAPI::isEveryoneCapable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isCapable
/**
* Checks if user has a partciular capability
*
* @param string $cap
* @param integer $siteId only needed if capability requires site access. you need to pass site_id (not id) field
* @return boolean
*/
function isCapable($cap, $siteId = null)
{
owa_coreAPI::debug("Checking if user is capable of: " . $cap);
// is this capability assigned to everyone?
// is this the global admin user?
// was no capability passed?
// if so, the user can see and do everything
if (owa_coreAPI::isEveryoneCapable($cap) || $this->user->isAdmin() || empty($cap)) {
owa_coreAPI::debug('No capability passed or user is an admin and capable of everything.');
return true;
}
// is this user's role capable?
if (!in_array($cap, $this->capabilities)) {
owa_coreAPI::debug('capability does not exist for this role. user is not capable');
return false;
}
// Does capability also require site access?
if ($this->isSiteAccessRequiredForCapability($cap)) {
owa_coreAPI::debug('Site access required for this capability.');
if (!$this->isSiteAccessible($siteId)) {
owa_coreAPI::debug('Site is not accessible for this user.');
return false;
} else {
owa_coreAPI::debug('Site is accessible for this user.');
}
}
return true;
}
示例2: isEveryoneCapable
protected function isEveryoneCapable($capability)
{
return owa_coreAPI::isEveryoneCapable($capability);
}