本文整理匯總了PHP中PermissionPeer::getAllValidForPartner方法的典型用法代碼示例。如果您正苦於以下問題:PHP PermissionPeer::getAllValidForPartner方法的具體用法?PHP PermissionPeer::getAllValidForPartner怎麽用?PHP PermissionPeer::getAllValidForPartner使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PermissionPeer
的用法示例。
在下文中一共展示了PermissionPeer::getAllValidForPartner方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getPermissionNames
/**
* Get the [permission_names] column value.
* If set to self::ALL_PARTNER_PERMISSIONS_WILDCARD (*), return all permisisons relevant for the partner.
* @var bool $filterDependencies true if should filter permissions which are set for partner but not valid due to dependencies on other permissions which are missing for the partner
* @return string
*/
public function getPermissionNames($filterDependencies = false, $skipTranslateWildcard = false)
{
// get from DB
$permissionNames = parent::getPermissionNames();
$permissionNames = array_map('trim', explode(',', $permissionNames));
$currentPartnerId = kCurrentContext::$ks_partner_id;
if (is_null($currentPartnerId) || $currentPartnerId === '') {
$currentPartnerId = kCurrentContext::$partner_id;
}
// translate * to permission names of all permissions valid for partner
if (in_array(self::ALL_PARTNER_PERMISSIONS_WILDCARD, $permissionNames) && !$skipTranslateWildcard) {
$permissionNames = array();
$permissions = PermissionPeer::getAllValidForPartner($currentPartnerId, $filterDependencies);
foreach ($permissions as $permission) {
$permissionNames[$permission->getName()] = $permission->getName();
}
}
$permissionNames = implode(',', $permissionNames);
if ($filterDependencies) {
$permissionNames = PermissionPeer::filterDependenciesByNames($permissionNames, $currentPartnerId);
}
return $permissionNames;
}