Skip to content

Commit

Permalink
Merge branch 'w29_MDL-27653_m22_usercasting' of git://github.com/skod…
Browse files Browse the repository at this point in the history
…ak/moodle
  • Loading branch information
Sam Hemelryk committed Jul 25, 2011
2 parents b039eeb + 2b55aca commit 7fe0eff
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/accesslib.php
Expand Up @@ -569,9 +569,9 @@ function has_capability($capability, $context, $user = null, $doanything = true)

// make sure there is a real user specified
if ($user === null) {
$userid = !empty($USER->id) ? $USER->id : 0;
$userid = isset($USER->id) ? $USER->id : 0;
} else {
$userid = !empty($user->id) ? $user->id : $user;
$userid = is_object($user) ? $user->id : $user;
}

// capability must exist
Expand Down Expand Up @@ -2841,9 +2841,9 @@ function is_guest($context, $user = null) {

// make sure there is a real user specified
if ($user === null) {
$userid = !empty($USER->id) ? $USER->id : 0;
$userid = isset($USER->id) ? $USER->id : 0;
} else {
$userid = !empty($user->id) ? $user->id : $user;
$userid = is_object($user) ? $user->id : $user;
}

if (isguestuser($userid)) {
Expand Down Expand Up @@ -2914,9 +2914,9 @@ function is_enrolled($context, $user = null, $withcapability = '', $onlyactive =

// make sure there is a real user specified
if ($user === null) {
$userid = !empty($USER->id) ? $USER->id : 0;
$userid = isset($USER->id) ? $USER->id : 0;
} else {
$userid = !empty($user->id) ? $user->id : $user;
$userid = is_object($user) ? $user->id : $user;
}

if (empty($userid)) {
Expand Down Expand Up @@ -4524,9 +4524,9 @@ function get_assignable_roles($context, $rolenamedisplay = ROLENAME_ALIAS, $with

// make sure there is a real user specified
if ($user === null) {
$userid = !empty($USER->id) ? $USER->id : 0;
$userid = isset($USER->id) ? $USER->id : 0;
} else {
$userid = !empty($user->id) ? $user->id : $user;
$userid = is_object($user) ? $user->id : $user;
}

if (!has_capability('moodle/role:assign', $context, $userid)) {
Expand Down

0 comments on commit 7fe0eff

Please sign in to comment.