Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 /**
  * Returns a peer instance associated with this om.
  *
  * Since Peer classes are not to have any instance attributes, this method returns the
  * same instance for all member of this class. The method could therefore
  * be static, but this would prevent one from overriding the behavior.
  *
  * @return     UserRolePeer
  */
 public function getPeer()
 {
     if (self::$peer === null) {
         self::$peer = new UserRolePeer();
     }
     return self::$peer;
 }