Skip to content

Commit

Permalink
Merge branch 'lti_admin' of https://github.com/baholladay/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonllao committed Jul 10, 2017
2 parents 4b0518a + 1aa11df commit 7fd09e2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
10 changes: 10 additions & 0 deletions mod/lti/db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@
)
),

// When the user arrives at the external tool, if they have this capability
// in Moodle, then they are given the Administrator role in the remote system,
// otherwise they are given Learner. See the lti_get_ims_role function.
'mod/lti:admin' => array(
'riskbitmask' => RISK_PERSONAL, // A bit of a guess, but seems likely.

'captype' => 'write',
'contextlevel' => CONTEXT_MODULE
),

// The ability to create or edit tool configurations for particular courses.
'mod/lti:addcoursetool' => array(
'captype' => 'write',
Expand Down
1 change: 1 addition & 0 deletions mod/lti/lang/en/lti.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@
$string['lti:addcoursetool'] = 'Add course-specific tool configurations';
$string['lti:grade'] = 'View grades returned by the external tool';
$string['lti:manage'] = 'Be an Instructor when the tool is launched';
$string['lti:admin'] = 'Be an Admininstrator when the tool is launched';
$string['lti:requesttooladd'] = 'Request a tool is configured site-wide';
$string['lti:view'] = 'Launch external tool activities';
$string['ltisettings'] = 'LTI settings';
Expand Down
4 changes: 3 additions & 1 deletion mod/lti/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,9 @@ function lti_get_ims_role($user, $cmid, $courseid, $islti2) {
}
}

if (is_siteadmin($user)) {
if (is_siteadmin($user) || has_capability('mod/lti:admin', $context)) {
// Make sure admins do not have the Learner role, then set admin role.
$roles = array_diff($roles, array('Learner'));
if (!$islti2) {
array_push($roles, 'urn:lti:sysrole:ims/lis/Administrator', 'urn:lti:instrole:ims/lis/Administrator');
} else {
Expand Down
2 changes: 1 addition & 1 deletion mod/lti/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

defined('MOODLE_INTERNAL') || die;

$plugin->version = 2017051500; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2017051600; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2017050500; // Requires this Moodle version.
$plugin->component = 'mod_lti'; // Full name of the plugin (used for diagnostics).
$plugin->cron = 0;

0 comments on commit 7fd09e2

Please sign in to comment.