From d27c5d3383f757de704433a502c2bbac98667e09 Mon Sep 17 00:00:00 2001 From: jerome Date: Mon, 16 Feb 2009 08:06:14 +0000 Subject: [PATCH] web service MDL-17135 add moodle/site:usewebservice capability - display only web service users into administration page --- lang/en_utf8/role.php | 1 + lib/adminlib.php | 2 +- lib/db/access.php | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lang/en_utf8/role.php b/lang/en_utf8/role.php index d2cb28706a..c778666282 100644 --- a/lang/en_utf8/role.php +++ b/lang/en_utf8/role.php @@ -223,6 +223,7 @@ $string['site:uploadusers'] = 'Upload new users from file'; $string['site:viewfullnames'] = 'Always see full names of users'; $string['site:viewparticipants'] = 'View participants'; $string['site:viewreports'] = 'View reports'; +$string['site:usewebservices'] = 'User can be served by Moodle web services'; $string['tag:manage'] = 'Manage all tags'; $string['tag:create'] = 'Create new tags'; $string['tag:edit'] = 'Edit existing tags'; diff --git a/lib/adminlib.php b/lib/adminlib.php index 200d282d21..8416b8b30c 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -4947,7 +4947,7 @@ class admin_setting_managewsusersettings extends admin_setting { $table->data = array(); foreach ($users as $user) { - if ( true) { //test if the users has has_capability('use_webservice') + if (has_capability("moodle/site:usewebservice",get_system_context(), $user->id)) { //test if the users has has_capability('use_webservice') $wsusersetting = ' ' . get_string("settings") .'' . "\n"; diff --git a/lib/db/access.php b/lib/db/access.php index 42ad0d0d66..341c499537 100644 --- a/lib/db/access.php +++ b/lib/db/access.php @@ -699,6 +699,13 @@ $moodle_capabilities = array( ) ), + 'moodle/site:usewebservices' => array( + 'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG | RISK_DATALOSS, + 'captype' => 'write', + 'contextlevel' => CONTEXT_SYSTEM, + 'legacy' => array() + ), + 'moodle/course:viewscales' => array( 'captype' => 'read', -- 2.39.5