]> git.mjollnir.org Git - moodle.git/commitdiff
accesslib: remove get_role_caps() merge_role_caps()
authormartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:24:14 +0000 (07:24 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:24:14 +0000 (07:24 +0000)
Both unused, and not part of the external API.

lib/accesslib.php

index f2c58754eb84a99ed9b70ddbda690f68e1101d7c..ca81dc4bc97c295c98a526c7042789270db48cf1 100755 (executable)
@@ -167,42 +167,6 @@ function get_role_context_caps($roleid, $context) {
     return $result;
 }
 
-function get_role_caps($roleid) {
-    $result = array();
-    if ($capabilities = get_records_select('role_capabilities',"roleid = $roleid")) {
-        foreach ($capabilities as $cap) {
-            if (!array_key_exists($cap->contextid, $result)) {
-                $result[$cap->contextid] = array();
-            }
-            $result[$cap->contextid][$cap->capability] = $cap->permission;
-        }
-    }
-    return $result;
-}
-
-function merge_role_caps($caps, $mergecaps) {
-    if (empty($mergecaps)) {
-        return $caps;
-    }
-
-    if (empty($caps)) {
-        return $mergecaps;
-    }
-
-    foreach ($mergecaps as $contextid=>$capabilities) {
-        if (!array_key_exists($contextid, $caps)) {
-            $caps[$contextid] = array();
-        }
-        foreach ($capabilities as $capability=>$permission) {
-            if (!array_key_exists($capability, $caps[$contextid])) {
-                $caps[$contextid][$capability] = 0;
-            }
-            $caps[$contextid][$capability] += $permission;
-        }
-    }
-    return $caps;
-}
-
 /**
  * Gets the accessdata for role "sitewide" 
  * (system down to course)