本文整理汇总了PHP中OA_Permission::switchAccount方法的典型用法代码示例。如果您正苦于以下问题:PHP OA_Permission::switchAccount方法的具体用法?PHP OA_Permission::switchAccount怎么用?PHP OA_Permission::switchAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OA_Permission
的用法示例。
在下文中一共展示了OA_Permission::switchAccount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: phpAds_registerGlobalUnslashed
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+---------------------------------------------------------------------------+
$Id: account-switch.php 37157 2009-05-28 12:31:10Z andrew.hill $
*/
// Require the initialisation file
require_once '../../init.php';
// Required files
require_once MAX_PATH . '/lib/OA/Dal.php';
require_once MAX_PATH . '/lib/OA/Dll.php';
require_once MAX_PATH . '/www/admin/config.php';
require_once LIB_PATH . '/Admin/Redirect.php';
require_once MAX_PATH . '/lib/OA/Admin/UI/AccountSwitch.php';
phpAds_registerGlobalUnslashed('return_url', 'account_id');
if (!empty($account_id)) {
OA_Permission::enforceAccess($account_id);
OA_Permission::switchAccount($account_id);
}
if (empty($return_url) && !empty($_SERVER['HTTP_REFERER'])) {
$return_url = $_SERVER['HTTP_REFERER'];
}
if (empty($return_url) || preg_match('/[\\r\\n]/', $_SERVER['HTTP_REFERER'])) {
$return_url = MAX::constructURL(MAX_URL_ADMIN, 'index.php');
} else {
$session['accountSwitch'] = 1;
phpAds_SessionDataStore();
}
// Ensure that we never return to this account-switch.php page, in the
// event that the session timed out, and then the user changed account
// manually...
$aUrlComponents = parse_url($return_url);
$aPathInformation = pathinfo($aUrlComponents['path']);
示例2: attemptToSwitchForAccess
function attemptToSwitchForAccess($entityTable, $entityId)
{
if (!($userId = OA_Permission::getUserId())) {
return false;
}
$doEntity = OA_Dal::staticGetDO($entityTable, $entityId);
if ($doEntity) {
$aAccountIds = $doEntity->getOwningAccountIds();
foreach ($aAccountIds as $accountId) {
if (OA_Permission::hasAccess($accountId)) {
OA_Permission::switchAccount($accountId, $hasAccess = true);
return true;
}
}
if (OA_Permission::isUserLinkedToAdmin()) {
$accountId = $doEntity->getRootAccountId();
OA_Permission::switchAccount($accountId, $hasAccess = true);
return true;
}
}
return false;
}