]> git.mjollnir.org Git - moodle.git/commitdiff
manage roles: MDL-8313 fix bugs with safe overrides.
authortjhunt <tjhunt>
Tue, 18 Nov 2008 08:08:18 +0000 (08:08 +0000)
committertjhunt <tjhunt>
Tue, 18 Nov 2008 08:08:18 +0000 (08:08 +0000)
admin/roles/lib.php
admin/roles/override.php
lib/accesslib.php

index 90cd39f5347ed3eebc90a544c61f40bae9929c70..03ba3967296511926f35335bd3e799fe9d4fa5d8 100644 (file)
@@ -818,7 +818,7 @@ class override_permissions_table_advanced extends capability_table_with_risks {
     /// Determine which capabilities should be locked.
         if ($safeoverridesonly) {
             foreach ($this->capabilities as $capid => $cap) {
-                if (!is_safe_capability($capability)) {
+                if (!is_safe_capability($cap)) {
                     $this->capabilities[$capid]->locked = true;
                     $this->haslockedcapabiltites = true;
                 }
index 1a89cfac15c9de4d761dc828d10f0430541182d0..637721b4419ef77b7fc6deaf83a0681af3f8a334 100755 (executable)
@@ -98,8 +98,8 @@
 
 /// Make sure this user can override that role
     if ($roleid && !isset($overridableroles[$roleid])) {
-        $a = stdClass;
-        $a->role = $roleid;
+        $a = new stdClass;
+        $a->roleid = $roleid;
         $a->context = $contextname;
         print_error('cannotoverriderolehere', '', get_context_url($context), $a);
     }
index ea9d07a634d10db69967b484a82551809f7dd41c..f6a70d06188fcf3ea531196c2d42e69ea630335e 100755 (executable)
@@ -1954,10 +1954,9 @@ function is_legacy($capabilityname) {
  *      safeoverrides capability should be allowed to change it.
  */
 function is_safe_capability($capability) {
-    return (RISK_DATALOSS | RISK_MANAGETRUST | RISK_CONFIG | RISK_XSS | RISK_PERSONAL) & $capability->riskbitmask;
+    return !((RISK_DATALOSS | RISK_MANAGETRUST | RISK_CONFIG | RISK_XSS | RISK_PERSONAL) & $capability->riskbitmask);
 }
 
-
 /**********************************
  * Context Manipulation functions *
  **********************************/