]> git.mjollnir.org Git - moodle.git/commitdiff
Clean up for role_assign()
authormoodler <moodler>
Thu, 31 Aug 2006 08:30:28 +0000 (08:30 +0000)
committermoodler <moodler>
Thu, 31 Aug 2006 08:30:28 +0000 (08:30 +0000)
lib/accesslib.php

index d806ce08b7deb802dee33c6153ae846e779be9a5..954a4c596778bd025922db6513e77c5def7ae756 100755 (executable)
@@ -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); 
     } 
 }