當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OA_Permission::attemptToSwitchToAccount方法代碼示例

本文整理匯總了PHP中OA_Permission::attemptToSwitchToAccount方法的典型用法代碼示例。如果您正苦於以下問題:PHP OA_Permission::attemptToSwitchToAccount方法的具體用法?PHP OA_Permission::attemptToSwitchToAccount怎麽用?PHP OA_Permission::attemptToSwitchToAccount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OA_Permission的用法示例。


在下文中一共展示了OA_Permission::attemptToSwitchToAccount方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: checkPermissions

 /**
  * Checks if user has access to specific area (for example admin or agency area)
  * Permissions are defined in www/admin/lib-permissions.inc.php file
  *
  * @access public
  *
  * @param integer $permissions
  * @param string $table  Table name
  * @param integer $id  Id (or empty if new is created)
  * @param unknown $allowed  check allowed
  * @param OA_Permission Does the current call require only a subset of the permissions?
  * 						If set to null, equivalent to asking permission to do everything on the object
  *
  * @return boolean  True if has access
  */
 function checkPermissions($permissions, $table = '', $id = null, $allowed = null, $operationAccessType = OA_Permission::OPERATION_ALL)
 {
     $isError = false;
     if (isset($permissions) && !OA_Permission::isAccount($permissions)) {
         if (!OA_Permission::attemptToSwitchToAccount($permissions)) {
             $isError = true;
         }
     }
     // Should this check also be part of checkPermissions?
     if (!empty($id) && !$this->checkIdExistence($table, $id)) {
         return false;
     }
     if (isset($id) && !OA_Permission::hasAccessToObject($table, $id, $operationAccessType)) {
         if (!OA_Permission::attemptToSwitchForAccess($table, $id)) {
             $isError = true;
         }
     }
     if (isset($allowed)) {
         if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER, OA_ACCOUNT_TRAFFICKER) && !OA_Permission::hasPermission($allowed)) {
             $isError = true;
         }
     }
     if ($isError) {
         $this->raiseError('Access forbidden');
         return false;
     } else {
         // Set system timezone and return
         OA_setTimeZoneLocal();
         return true;
     }
 }
開發者ID:ballistiq,項目名稱:revive-adserver,代碼行數:46,代碼來源:Dll.php

示例2: checkPermissions

 /**
  * Checks if user has access to specific area (for example admin or agency area)
  * Permissions are defined in www/admin/lib-permissions.inc.php file
  *
  * @access public
  *
  * @param integer $permissions
  * @param string $table  Table name
  * @param integer $id  Id (or empty if new is created)
  * @param unknown $allowed  check allowed
  *
  * @return boolean  True if has access
  */
 function checkPermissions($permissions, $table = '', $id = null, $allowed = null)
 {
     $isError = false;
     if (isset($permissions) && !OA_Permission::isAccount($permissions)) {
         if (!OA_Permission::attemptToSwitchToAccount($permissions)) {
             $isError = true;
         }
     }
     if (!empty($id) && !$this->checkIdExistence($table, $id)) {
         return false;
     }
     if (isset($id) && !OA_Permission::hasAccessToObject($table, $id)) {
         if (!OA_Permission::attemptToSwitchForAccess($table, $id)) {
             $isError = true;
         }
     }
     if (isset($allowed)) {
         if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER, OA_ACCOUNT_TRAFFICKER) && !OA_Permission::hasPermission($allowed)) {
             $isError = true;
         }
     }
     if ($isError) {
         $this->raiseError('Access forbidden');
         return false;
     } else {
         return true;
     }
 }
開發者ID:villos,項目名稱:tree_admin,代碼行數:41,代碼來源:Dll.php

示例3: enforceAccount

 /**
  * A method to show an error if the currently active account of an user
  * doesn't match
  *
  * This function takes either an array as the first parameter or
  * a variable number of parameters
  *
  * @static
  * @param string $accountType user type
  */
 function enforceAccount($accountType)
 {
     $aArgs = is_array($accountType) ? $accountType : func_get_args();
     $isAccount = OA_Permission::isAccount($aArgs);
     if (!$isAccount) {
         OA_Permission::redirectIfManualAccountSwitch();
         $isAccount = OA_Permission::attemptToSwitchToAccount($aArgs);
     }
     OA_Permission::enforceTrue($isAccount);
 }
開發者ID:villos,項目名稱:tree_admin,代碼行數:20,代碼來源:Permission.php


注:本文中的OA_Permission::attemptToSwitchToAccount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。