$aRes = array_keys($this->m_aUserProfiles[$iUser]); } else { // no profile has been defined for this user $aRes = array(); } } else { $aProfileRes = array(); foreach ($this->m_aDimensions as $iDimension => $oDimension) { foreach ($this->GetMatchingProfilesByDim($oUser, $oObject, $oDimension) as $iProfile) { @($aProfileRes[$iProfile] += 1); } } $aRes = array(); $iDimCount = count($this->m_aDimensions); foreach ($aProfileRes as $iProfile => $iMatches) { if ($iMatches == $iDimCount) { $aRes[] = $iProfile; } } } // store into the cache $this->m_aMatchingProfiles[$iUser][$sClass][$iObjectRef] = $aRes; return $aRes; } public function FlushPrivileges() { $this->CacheData(); } } UserRights::SelectModule('UserRightsProjection');
case 'no': default: $iRetCode = UR_ALLOWED_NO; break; } return $iRetCode; } public function IsStimulusAllowed($oUser, $sClass, $sStimulusCode, $oInstanceSet = null) { $oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixClassStimulusGrant WHERE class = '{$sClass}' AND stimulus = '{$sStimulusCode}' AND userid = '{$oUser->GetKey()}'")); if ($oSet->Count() < 1) { return UR_ALLOWED_NO; } $oGrantRecord = $oSet->Fetch(); switch ($oGrantRecord->Get('permission')) { case 'yes': $iRetCode = UR_ALLOWED_YES; break; case 'no': default: $iRetCode = UR_ALLOWED_NO; break; } return $iRetCode; } public function FlushPrivileges() { } } UserRights::SelectModule('UserRightsMatrix');
{ $sAttCode = null; $aCallSpec = array($sClass, 'MapContextParam'); if ($sClass == 'Organization' || is_subclass_of($sClass, 'Organization')) { $sAttCode = 'id'; } elseif (is_callable($aCallSpec)) { $sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) { // Skip silently. The data model checker will tell you something about this... $sAttCode = null; } } elseif (MetaModel::IsValidAttCode($sClass, 'org_id')) { $sAttCode = 'org_id'; } return $sAttCode; } /** * Determine wether the objects can be shared by the mean of a class SharedObject **/ protected static function HasSharing() { static $bHasSharing; if (!isset($bHasSharing)) { $bHasSharing = class_exists('SharedObject'); } return $bHasSharing; } } UserRights::SelectModule('UserRightsProfile');
public function IsPortalUser($oUser) { return true; } public function Init() { return true; } public function GetSelectFilter($oUser, $sClass, $aSettings = array()) { $oNullFilter = new DBObjectSearch($sClass); return $oNullFilter; } public function IsActionAllowed($oUser, $sClass, $iActionCode, $oInstanceSet = null) { return UR_ALLOWED_YES; } public function IsStimulusAllowed($oUser, $sClass, $sStimulusCode, $oInstanceSet = null) { return UR_ALLOWED_YES; } public function IsActionAllowedOnAttribute($oUser, $sClass, $sAttCode, $iActionCode, $oInstanceSet = null) { return UR_ALLOWED_YES; } public function FlushPrivileges() { } } UserRights::SelectModule('UserRightsNull');