Skip to content

Commit

Permalink
Merge pull request #11 from saylordotorg/feat/sync-admins
Browse files Browse the repository at this point in the history
Admin sync
  • Loading branch information
jazinheira authored Apr 12, 2019
2 parents fee5677 + 7652d10 commit ef4cbc8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lang/en/local_discoursesso.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$string['adminsynclabel'] = 'Sync administrators?';
$string['adminsynchelp'] = 'When enabled, Moodle site administrators will be an admin in Discourse.';
$string['discourseurllabel'] = 'Discourse URL';
$string['discourseurlhelp'] = 'The URL of your Discourse instance, i.e. \'https://meta.discourse.org\'.';
$string['localelabel'] = 'Sync user locale?';
Expand Down
6 changes: 6 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,11 @@
$help = get_string('localehelp', 'local_discoursesso');
$setting = new admin_setting_configcheckbox($name, $label, $help, 1);
$settings->add($setting);

$name = 'local_discoursesso/adminsync';
$label = get_string('adminsynclabel', 'local_discoursesso');
$help = get_string('adminsynchelp', 'local_discoursesso');
$setting = new admin_setting_configcheckbox($name, $label, $help, 1);
$settings->add($setting);

}
8 changes: 8 additions & 0 deletions sso.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@
$extraparams['locale_force_update'] = 'true';
}

// Sync admin status, if enabled.
if (get_config('local_discoursesso', 'adminsync')) {
// Check if this user is an admin.
if (is_siteadmin()) {
$extraparams['admin']='true';
}
}

// Build query string and redirect back to the Discourse site.
$query = $ssohelper->getSignInString($nonce, $userid, $useremail, $extraparams);
$url = $CFG->discoursesso_discourse_url . '/session/sso_login?' . $query;
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2019041100;
$plugin->version = 2019041200;
$plugin->requires = 2016052306; // Requires this Moodle version - at least 3.1
$plugin->cron = 0;
$plugin->component = 'local_discoursesso';

$plugin->release = '1.1.0';
$plugin->release = '1.2.0';
$plugin->maturity = MATURITY_STABLE;

0 comments on commit ef4cbc8

Please sign in to comment.