Skip to content

Commit

Permalink
EQ-2277 Add capability requirements to equella web service definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongsheng Cai committed Jul 23, 2015
1 parent b7ea566 commit f7beb2d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
12 changes: 12 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
2015-07-23 Dongsheng Cai <[email protected]>

EQ-2277 Add capability requirements to equella web service definition

2015-07-20 Dongsheng Cai <[email protected]>

EQ-2269 Add filename to module db record

2015-06-11 Dongsheng Cai <[email protected]>

Ability to disable self signed ssl certificate check

2015-05-13 Dongsheng Cai <[email protected]>

New release requires 2.7 and up.
Expand Down
19 changes: 13 additions & 6 deletions db/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,23 @@
'classpath' => 'mod/equella/externallib.php',
'description' => 'List the courses for the given user.',
'type' => 'read',
'capabilities' => 'moodle/course:view'
),
'equella_list_sections_for_course' => array(
'classname' => 'equella_external',
'methodname' => 'list_sections_for_course',
'classpath' => 'mod/equella/externallib.php',
'description' => 'List the sections for the given course.',
'type' => 'read',
'capabilities' => 'moodle/course:view'
),
'equella_add_item_to_course' => array(
'classname' => 'equella_external',
'methodname' => 'add_item_to_course',
'classpath' => 'mod/equella/externallib.php',
'description' => 'Add an EQUELLA item to a given course by a given user.',
'type' => 'write',
'capabilities' => 'moodle/course:manageactivities'
),
'equella_test_connection' => array(
'classname' => 'equella_external',
Expand All @@ -48,61 +51,65 @@
'classpath' => 'mod/equella/externallib.php',
'description' => 'List all the locations that the supplied item is used.',
'type' => 'read',
'capabilities' => 'moodle/course:view'
),
'equella_find_all_usage' => array(
'classname' => 'equella_external',
'methodname' => 'find_all_usage',
'classpath' => 'mod/equella/externallib.php',
'description' => 'List all the locations that Equella content is used.',
'type' => 'read',
'capabilities' => 'moodle/course:view'
),
'equella_unfiltered_usage_count' => array(
'classname' => 'equella_external',
'methodname' => 'unfiltered_usage_count',
'classpath' => 'mod/equella/externallib.php',
'description' => 'Get the number of results that would be returned by equella_find_all_usages without a course ID and folder ID value, and with an unlimited count',
'type' => 'read',
'capabilities' => 'moodle/course:view'
),
'equella_get_course_code' => array(
'classname' => 'equella_external',
'methodname' => 'get_course_code',
'classpath' => 'mod/equella/externallib.php',
'description' => 'Returns the course code for the supplied course id',
'type' => 'read',
'capabilities' => 'moodle/course:view'
),
'equella_edit_item' => array(
'classname' => 'equella_external',
'methodname' => 'edit_item',
'classpath' => 'mod/equella/externallib.php',
'description' => 'Modify an item in moodle',
'type' => 'write',
'capabilities' => 'moodle/course:manageactivities'
),
'equella_move_item' => array(
'classname' => 'equella_external',
'methodname' => 'move_item',
'classpath' => 'mod/equella/externallib.php',
'description' => 'Move an item in moodle',
'type' => 'write',
'capabilities' => 'moodle/course:manageactivities'
),
'equella_delete_item' => array(
'classname' => 'equella_external',
'methodname' => 'delete_item',
'classpath' => 'mod/equella/externallib.php',
'description' => 'Deletes an item in moodle',
'type' => 'write',
'capabilities' => 'moodle/course:manageactivities'
)
);

$functionnames = array_keys($functions);

$services = array(
'equellaservice' => array(
'functions' => array ('equella_list_courses_for_user', 'equella_list_sections_for_course',
'equella_add_item_to_course', 'equella_test_connection',
'equella_find_usage_for_item', 'equella_find_all_usage', 'equella_unfiltered_usage_count',
'equella_get_course_code', 'equella_edit_item', 'equella_delete_item', 'equella_move_item'),
'functions' => $functionnames,
'requiredcapability' => 'moodle/course:manageactivities',
'restrictedusers' => 1,
'enabled' => 1,
)
);

?>
13 changes: 7 additions & 6 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,20 @@ function ecs($configoption, $params = null) {

$rolearchetypes = get_role_archetypes();
foreach(get_all_editing_roles() as $role) {
$sectionname = 'equella_' . $role->shortname . '_role_group';
if (in_array($role->shortname, $rolearchetypes)) {
$heading = ecs('group.' . $role->shortname);
$shortname = clean_param($role->shortname, PARAM_ALPHANUM);
if (in_array($shortname, $rolearchetypes)) {
$heading = ecs('group.' . $shortname);
} else {
$heading = ecs('group.noname', $role->shortname);
$heading = ecs('group.noname', $shortname);
if (!empty($role->name)) {
$heading = ecs('group', $role->name);
}
}
$sectionname = 'equella_' . $shortname . '_role_group';
$settings->add(new equella_setting_left_heading($sectionname, $heading, ''));

$settings->add(new admin_setting_configtext("equella_{$role->shortname}_shareid", ecs('sharedid.title'), $description, $defaultvalue, PARAM_TEXT));
$settings->add(new admin_setting_configtext("equella_{$role->shortname}_sharedsecret", ecs('sharedsecret.title'), $description, $defaultvalue, PARAM_TEXT));
$settings->add(new admin_setting_configtext("equella_{$shortname}_shareid", ecs('sharedid.title'), $description, $defaultvalue, PARAM_TEXT));
$settings->add(new admin_setting_configtext("equella_{$shortname}_sharedsecret", ecs('sharedsecret.title'), $description, $defaultvalue, PARAM_TEXT));
}
// ///////////////////////////////////////////////////////////////////////////////
//
Expand Down

0 comments on commit f7beb2d

Please sign in to comment.