From 5b5781f4f5e4868e9e7e1dc3c8029f31e53e33b4 Mon Sep 17 00:00:00 2001 From: toyomoyo Date: Fri, 22 Sep 2006 01:46:45 +0000 Subject: [PATCH] some new functions to help backuo --- lib/accesslib.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/accesslib.php b/lib/accesslib.php index bc2e5930a4..11a0425e74 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -2723,6 +2723,20 @@ function get_capabilities_from_role_on_context($role, $context) { AND roleid = $role->id"); } +// find out which roles has assignment on this context +function get_roles_with_assignment_on_context($context) { + + global $CFG; + + return get_records_sql("SELECT DISTINCT r.* + FROM {$CFG->prefix}role_assignments ra, + {$CFG->prefix}role r + WHERE ra.roleid = r.id + AND ra.contextid = $context->id"); +} + + + /* find all user assignemnt of users for this role, on this context */ function get_users_from_role_on_context($role, $context) { -- 2.39.5