示例#1
0
 /**
  * This method performs data validation for the default account ID
  *
  * @param OA_Dll_UserInfo $oUser
  * @return boolean
  */
 function _validateDefaultAccount($oUser)
 {
     if (!OA_Permission::isUserLinkedToAccount($oUser->defaultAccountId, $oUser->userId)) {
         $this->raiseError(self::ERROR_DEFAULT_ACC_NOT_LINKED);
         return false;
     }
     return true;
 }
示例#2
0
 /**
  * This method performs data validation for the default account ID
  *
  * @param OA_Dll_UserInfo $oUser
  * @return boolean
  */
 function _validateDefaultAccount($oUser)
 {
     if (!OA_Permission::isUserLinkedToAccount($oUser->defaultAccountId, $oUser->userId)) {
         $this->raiseError('The specified default account is not linked to the user');
         return false;
     }
     return true;
 }
示例#3
0
 /**
  * Links user with account and set apropriate messages.
  * Common method reused across user access pages
  *
  * @param integer $userId  User ID
  * @param integer $accountId  Account ID
  * @param array $permissions Array of permissions
  * @param array $aAllowedPermissions  Array of allowed permissions
  */
 function linkUserToAccount($userId, $accountId, $permissions, $aAllowedPermissions)
 {
     if (!empty($userId)) {
         if (!OA_Permission::isUserLinkedToAccount($accountId, $userId)) {
             OA_Session::setMessage($GLOBALS['strUserLinkedToAccount']);
         } else {
             OA_Session::setMessage($GLOBALS['strUserAccountUpdated']);
         }
         OA_Permission::setAccountAccess($accountId, $userId);
         OA_Permission::storeUserAccountsPermissions($permissions, $accountId, $userId, $aAllowedPermissions);
     }
 }
示例#4
0
 /**
  * A method to check if the user has access to a specific account
  *
  * User cuold either has direct access to account or indirect.
  * Indirect access could be in case if user has access to one of the parent
  * entities.
  *
  * @static
  * @param int $accountId
  * @return boolean
  */
 function hasAccess($accountId, $userId = null)
 {
     if (empty($userId)) {
         $userId = OA_Permission::getUserId();
     }
     return OA_Permission::isUserLinkedToAccount($accountId, $userId) || OA_Permission::isUserLinkedToAdmin($userId);
 }