]> git.mjollnir.org Git - moodle.git/commitdiff
merged change, fixed a bug where'0' is written when calling capability_assign()
authortoyomoyo <toyomoyo>
Wed, 11 Oct 2006 02:18:09 +0000 (02:18 +0000)
committertoyomoyo <toyomoyo>
Wed, 11 Oct 2006 02:18:09 +0000 (02:18 +0000)
lib/accesslib.php

index 1a5f8f56eed29b26727c9d14857165eeaa7825a2..23260ca4eccb86dd20af3126cf72c177efc05959 100755 (executable)
@@ -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);