MDL-35216 My Moodle - Admin setting for controlling guest access to my moodle

This commit is contained in:
Itamar Tzadok 2012-09-14 16:09:24 -04:00 committed by Dan Poltawski
parent 2f6073ca71
commit 110831ceaa
3 changed files with 8 additions and 0 deletions

View File

@ -97,6 +97,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
HOMEPAGE_USER => new lang_string('userpreference', 'admin')
);
$temp->add(new admin_setting_configselect('defaulthomepage', new lang_string('defaulthomepage', 'admin'), new lang_string('configdefaulthomepage', 'admin'), HOMEPAGE_SITE, $choices));
$temp->add(new admin_setting_configcheckbox('allowguestmymoodle', new lang_string('allowguestmymoodle', 'admin'), new lang_string('configallowguestmymoodle', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('navshowcategories', new lang_string('navshowcategories', 'admin'), new lang_string('confignavshowcategories', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('navshowmycoursecategories', new lang_string('navshowmycoursecategories', 'admin'), new lang_string('navshowmycoursecategories_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('navshowallcourses', new lang_string('navshowallcourses', 'admin'), new lang_string('confignavshowallcourses', 'admin'), 0));

View File

@ -49,6 +49,7 @@ $string['allowediplist'] = 'Allowed IP list';
$string['allowemailaddresses'] = 'Allowed email domains';
$string['allowframembedding'] = 'Allow frame embedding';
$string['allowframembedding_help'] = 'Allow embedding of this site in frames on external sites. Enabling of this feature is not recommended for security reasons.';
$string['allowguestmymoodle'] = 'Allow guest access to My Moodle';
$string['allowobjectembed'] = 'Allow EMBED and OBJECT tags';
$string['allowthemechangeonurl'] = 'Allow theme changes in the URL';
$string['allowuserblockhiding'] = 'Allow users to hide blocks';
@ -123,6 +124,7 @@ $string['configallowblockstodock'] = 'If enabled and supported by the selected t
$string['configallowcategorythemes'] = 'If you enable this, then themes can be set at the category level. This will affect all child categories and courses unless they have specifically set their own theme. WARNING: Enabling category themes may affect performance.';
$string['configallowcoursethemes'] = 'If you enable this, then courses will be allowed to set their own themes. Course themes override all other theme choices (site, user, or session themes)';
$string['configallowemailaddresses'] = 'If you want to restrict all new email addresses to particular domains, then list them here separated by spaces. All other domains will be rejected. To allow subdomains add the domain with a preceding \'.\'. eg <strong>ourcollege.edu.au .gov.au</strong>';
$string['configallowguestmymoodle'] = 'If enabled guests can access My Moodle, otherwise guests are redirected to the site front page.';
$string['configallowobjectembed'] = 'As a default security measure, normal users are not allowed to embed multimedia (like Flash) within texts using explicit EMBED and OBJECT tags in their HTML (although it can still be done safely using the mediaplugins filter). If you wish to allow these tags then enable this option.';
$string['configallowoverride'] = 'You can allow people with the roles on the left side to override some of the column roles';
$string['configallowoverride2'] = 'Select which role(s) can be overridden by each role in the left column.<br />Note that these settings only apply to users who have either the capability moodle/role:override or the capability moodle/role:safeoverride allowed.';

View File

@ -48,6 +48,11 @@ require_login();
$strmymoodle = get_string('myhome');
if (isguestuser()) { // Force them to see system default, no editing allowed
// If guests are not allowed my moodle, send them to front page.
if (empty($CFG->allowguestmymoodle)) {
redirect(new moodle_url('/', array('redirect' => 0)));
}
$userid = NULL;
$USER->editing = $edit = 0; // Just in case
$context = context_system::instance();