本文整理汇总了PHP中PermissionPeer::filterDependenciesByNames方法的典型用法代码示例。如果您正苦于以下问题:PHP PermissionPeer::filterDependenciesByNames方法的具体用法?PHP PermissionPeer::filterDependenciesByNames怎么用?PHP PermissionPeer::filterDependenciesByNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PermissionPeer
的用法示例。
在下文中一共展示了PermissionPeer::filterDependenciesByNames方法的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;
}