本文整理汇总了PHP中RoleModel::GetPermissions方法的典型用法代码示例。如果您正苦于以下问题:PHP RoleModel::GetPermissions方法的具体用法?PHP RoleModel::GetPermissions怎么用?PHP RoleModel::GetPermissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RoleModel
的用法示例。
在下文中一共展示了RoleModel::GetPermissions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetSession
public function GetSession($UserID, $Refresh = FALSE)
{
// Ask for the user. This will check cache first.
$User = $this->GetID($UserID, DATASET_TYPE_OBJECT);
if (!$User) {
return FALSE;
}
// If we require confirmation and user is not confirmed
$ConfirmEmail = C('Garden.Registration.ConfirmEmail', false);
$Confirmed = GetValue('Confirmed', $User);
if ($ConfirmEmail && !$Confirmed) {
// Replace permissions with those of the ConfirmEmailRole
$ConfirmEmailRoleID = C('Garden.Registration.ConfirmEmailRole');
$RoleModel = new RoleModel();
$RolePermissions = $RoleModel->GetPermissions($ConfirmEmailRoleID);
$Permissions = UserModel::CompilePermissions($RolePermissions);
// Ensure Confirm Email role can always sign in
if (!in_array('Garden.SignIn.Allow', $Permissions)) {
$Permissions[] = 'Garden.SignIn.Allow';
}
$User->Permissions = $Permissions;
// Otherwise normal loadings!
} else {
if ($User && ($User->Permissions == '' || Gdn::Cache()->ActiveEnabled())) {
$User->Permissions = $this->DefinePermissions($UserID);
}
}
// Remove secret info from session
unset($User->Password, $User->HashMethod);
return $User;
}