From: toyomoyo Date: Wed, 11 Oct 2006 02:18:09 +0000 (+0000) Subject: merged change, fixed a bug where'0' is written when calling capability_assign() X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=96986241f56bec69ed9a0ffdd4603f044d6ea411;p=moodle.git merged change, fixed a bug where'0' is written when calling capability_assign() --- diff --git a/lib/accesslib.php b/lib/accesslib.php index 1a5f8f56ee..23260ca4ec 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -1421,13 +1421,15 @@ function delete_role($roleid) { * @param contextid - context id * @param roleid - role id * @param permission - int 1,-1 or -1000 + * should not be writing if permission is 0 */ function assign_capability($capability, $permission, $roleid, $contextid, $overwrite=false) { global $USER; - if (empty($permission) || $permission == 0) { // if permission is not set + if (empty($permission) || $permission == CAP_INHERIT) { // if permission is not set unassign_capability($capability, $roleid, $contextid); + return true; } $existing = get_record('role_capabilities', 'contextid', $contextid, 'roleid', $roleid, 'capability', $capability);