From 86cbff7abd128a260c04ee09c195b34936cd3852 Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 31 Aug 2006 08:30:28 +0000 Subject: [PATCH] Clean up for role_assign() --- lib/accesslib.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/accesslib.php b/lib/accesslib.php index d806ce08b7..954a4c5967 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -1170,12 +1170,10 @@ function role_assign($roleid, $userid, $groupid, $contextid, $timestart=0, $time * @return boolean - success or failure */ function role_unassign($roleid, $userid, $groupid, $contextid) { - if ($groupid) { - // do nothing yet as this is not implemented - } - else { - return delete_records('role_assignments', 'userid', $userid, - 'roleid', $roleid, 'contextid', $contextid); + if ($groupid && empty($userid)) { + return delete_records('role_assignments', 'groupid', $groupid, 'roleid', $roleid, 'contextid', $contextid); + } else { + return delete_records('role_assignments', 'userid', $userid, 'roleid', $roleid, 'contextid', $contextid); } } -- 2.39.5