Clean up for role_assign()

This commit is contained in:
moodler
2006-08-31 08:30:28 +00:00
parent 9f7f87a9a6
commit 86cbff7abd
+4 -6
View File
@@ -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);
}
}