]> git.mjollnir.org Git - moodle.git/commitdiff
accesslib: remove references to deprecated context_rel table and insert_context_rel()
authormartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:29:31 +0000 (07:29 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:29:31 +0000 (07:29 +0000)
These references to the deprecated functions were erroring out. Remove
them.

Note however that other role related cleanups done as part of
MDL-10679 "improvement to context_rel table and load_user_capability()"
are kept.

lib/accesslib.php

index e428aee4c0dcbac7220cfc560fa3cf339ec1e979..bdb6e3784e01fcfe60a805b32fc905f2a02f67f4 100755 (executable)
@@ -2435,15 +2435,6 @@ function delete_role($roleid) {
 
         delete_records('role_capabilities', 'roleid', $roleid);
 
-        // MDL-10679, delete from context_rel if this role holds the last override in these contexts
-        if ($contexts) {
-            foreach ($contexts as $context) {
-                if (!record_exists('role_capabilities', 'contextid', $context->contextid)) {
-                    delete_records('context_rel', 'c1', $context->contextid);
-                }
-            }
-        }
-
         delete_records('role_allow_assign', 'roleid', $roleid);
         delete_records('role_allow_assign', 'allowassign', $roleid);
         delete_records('role_allow_override', 'roleid', $roleid);
@@ -2497,13 +2488,10 @@ function assign_capability($capability, $permission, $roleid, $contextid, $overw
         return update_record('role_capabilities', $cap);
     } else {
         $c = get_record('context', 'id', $contextid);
-        /// MDL-10679 insert context rel here
-        insert_context_rel ($c);
         return insert_record('role_capabilities', $cap);
     }
 }
 
-
 /**
  * Unassign a capability from a role.
  * @param $roleid - the role id
@@ -2516,16 +2504,7 @@ function unassign_capability($capability, $roleid, $contextid=NULL) {
         // delete from context rel, if this is the last override in this context
         $status = delete_records('role_capabilities', 'capability', $capability,
                 'roleid', $roleid, 'contextid', $contextid);
-
-        // MDL-10679, if this is no more overrides for this context
-        // delete entries from context where this context is a child
-        if (!record_exists('role_capabilities', 'contextid', $contextid)) {
-            delete_records('context_rel', 'c1', $contextid);
-        }
-
     } else {
-        // There is no need to delete from context_rel here because
-        // this is only used for legacy, for now
         $status = delete_records('role_capabilities', 'capability', $capability,
                 'roleid', $roleid);
     }