From: skodak Date: Wed, 31 Jan 2007 21:05:32 +0000 (+0000) Subject: MDL-8373 Add new predefined role "Authenticated user" for all logged in users X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=c785d40ac33516eb565e857cf7149d9574257883;p=moodle.git MDL-8373 Add new predefined role "Authenticated user" for all logged in users --- diff --git a/admin/settings/users.php b/admin/settings/users.php index dbd63a1903..ae4185cb22 100644 --- a/admin/settings/users.php +++ b/admin/settings/users.php @@ -38,12 +38,23 @@ if ($studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW } else { $studentrole->id = 0; } +if ($userroles = get_roles_with_capability('moodle/legacy:user', CAP_ALLOW)) { + $userrole = array_shift($userroles); /// Take the first one +} else { + $userrole->id = 0; +} $assignableroles = get_assignable_roles($context); +$allroles = array(); +if ($roles = get_all_roles()) { + foreach ($roles as $role) { + $allroles[$role->id] = strip_tags(format_string($role->name, true)); + } +} $temp->add(new admin_setting_configselect('notloggedinroleid', get_string('notloggedinroleid', 'admin'), get_string('confignotloggedinroleid', 'admin'), $guestrole->id, $assignableroles )); $temp->add(new admin_setting_configselect('defaultuserroleid', get_string('defaultuserroleid', 'admin'), - get_string('configdefaultuserroleid', 'admin'), $guestrole->id, $assignableroles)); + get_string('configdefaultuserroleid', 'admin'), $userrole->id, $allroles)); $temp->add(new admin_setting_configselect('defaultcourseroleid', get_string('defaultcourseroleid', 'admin'), get_string('configdefaultcourseroleid', 'admin'), $studentrole->id, $assignableroles)); diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php index 99a74365eb..e44e0b8601 100644 --- a/lang/en_utf8/admin.php +++ b/lang/en_utf8/admin.php @@ -73,7 +73,7 @@ $string['configdefaultallowedmodules'] = 'For the courses which fall into the ab $string['configdefaultcourseroleid'] = 'Users who enrol in a course will be automatically assigned this role.'; $string['configdefaultrequestcategory'] = 'Courses requested by users will be automatically placed in this category.'; $string['configdefaultrequestedcategory'] = 'Default category to put courses that were requested into, if they\'re approved.'; -$string['configdefaultuserroleid'] = 'All logged in users will be given the capabilities of the role you specify here, at the site level, in ADDITION to any other roles they may have been given. The default is the Guest role. Note that this will not conflict with other roles they have, it just ensures that all users can do something useful at the site level (eg read forum discussions, resources, etc).'; +$string['configdefaultuserroleid'] = 'All logged in users will be given the capabilities of the role you specify here, at the site level, in ADDITION to any other roles they may have been given. The default is the Authenticated user role (or Guest role in older versions). Note that this will not conflict with other roles they have, it just ensures that all users have capabilities that are not assignable at the course level (eg post blog entries, manage own calendar, etc).'; $string['configdeleteunconfirmed'] = 'If you are using email authentication, this is the period within which a response will be accepted from users. After this period, old unconfirmed accounts are deleted.'; $string['configdenyemailaddresses'] = 'To deny email addresses from particular domains list them here in the same way. All other domains will be accepted. eg hotmail.com yahoo.co.uk'; $string['configdigestmailtime'] = 'People who choose to have emails sent to them in digest form will be emailed the digest daily. This setting controls which time of day the daily mail will be sent (the next cron that runs after this hour will send it).'; diff --git a/lang/en_utf8/moodle.php b/lang/en_utf8/moodle.php index 2ea6213708..108d6d82ac 100644 --- a/lang/en_utf8/moodle.php +++ b/lang/en_utf8/moodle.php @@ -123,6 +123,8 @@ $string['assignstudentsnote'] = 'Note: it may not be necessary to use this page, $string['assignstudentspass'] = 'All you may need to do is notify your students of the enrolment key for this course, which is currently set to: \'$a\''; $string['assignteachers'] = 'Assign teachers'; $string['authentication'] = 'Authentication'; +$string['authenticateduser'] = 'Authenticated user'; +$string['authenticateduserdescription'] = 'All logged in users.'; $string['autosubscribe'] = 'Forum auto-subscribe'; $string['autosubscribeno'] = 'No: don\'t automatically subscribe me to forums'; $string['autosubscribeyes'] = 'Yes: when I post, subscribe me to that forum'; diff --git a/lang/en_utf8/role.php b/lang/en_utf8/role.php index aa74f0353f..71f0c12190 100644 --- a/lang/en_utf8/role.php +++ b/lang/en_utf8/role.php @@ -62,6 +62,7 @@ $string['legacy:editingteacher'] = 'LEGACY ROLE: Teacher (editing)'; $string['legacy:guest'] = 'LEGACY ROLE: Guest'; $string['legacy:student'] = 'LEGACY ROLE: Student'; $string['legacy:teacher'] = 'LEGACY ROLE: Teacher (non-editing)'; +$string['legacy:user'] = 'LEGACY ROLE: Authenticated user'; $string['listallroles'] = 'List all roles'; $string['manageroles'] = 'Manage roles'; $string['metaassignerror'] = 'Can not assign this role to user \"$a\" because Manage metacourse capability is needed.'; diff --git a/lib/accesslib.php b/lib/accesslib.php index da9654e0a0..cde7ab51fe 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -1337,6 +1337,8 @@ function moodle_install_roles() { addslashes(get_string('defaultcoursestudentdescription')), 'moodle/legacy:student'); $guestrole = create_role(addslashes(get_string('guest')), 'guest', addslashes(get_string('guestdescription')), 'moodle/legacy:guest'); + $userrole = create_role(addslashes(get_string('authenticateduser')), 'user', + addslashes(get_string('authenticateduserdescription')), 'moodle/legacy:user'); /// Now is the correct moment to install capabilities - after creation of legacy roles, but before assigning of roles @@ -1480,6 +1482,7 @@ function moodle_install_roles() { allow_override($adminrole, $editteacherrole); allow_override($adminrole, $studentrole); allow_override($adminrole, $guestrole); + allow_override($adminrole, $userrole); /// Delete the old user tables when we are done diff --git a/lib/db/access.php b/lib/db/access.php index 5f85fc966b..7fe2e915e8 100644 --- a/lib/db/access.php +++ b/lib/db/access.php @@ -47,6 +47,11 @@ $moodle_capabilities = array( 'contextlevel' => CONTEXT_SYSTEM ), + 'moodle/legacy:user' => array( + + 'captype' => 'legacy', + 'contextlevel' => CONTEXT_SYSTEM + ), 'moodle/legacy:student' => array( @@ -664,6 +669,7 @@ $moodle_capabilities = array( 'contextlevel' => CONTEXT_SYSTEM, 'legacy' => array( 'guest' => CAP_ALLOW, + 'user' => CAP_ALLOW, 'student' => CAP_ALLOW, 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, @@ -679,11 +685,7 @@ $moodle_capabilities = array( 'captype' => 'write', 'contextlevel' => CONTEXT_SYSTEM, 'legacy' => array( - 'guest' => CAP_ALLOW, // needed for default role that allows everybody to post blog entries - 'student' => CAP_ALLOW, - 'teacher' => CAP_ALLOW, - 'editingteacher' => CAP_ALLOW, - 'coursecreator' => CAP_ALLOW, + 'user' => CAP_ALLOW, 'admin' => CAP_ALLOW ) ), @@ -735,11 +737,7 @@ $moodle_capabilities = array( 'captype' => 'write', 'contextlevel' => CONTEXT_SYSTEM, 'legacy' => array( - 'guest' => CAP_ALLOW, // needed for default role that allows everybody to add user entries - 'student' => CAP_ALLOW, - 'teacher' => CAP_ALLOW, - 'editingteacher' => CAP_ALLOW, - 'coursecreator' => CAP_ALLOW, + 'user' => CAP_ALLOW, 'admin' => CAP_ALLOW ) ), diff --git a/version.php b/version.php index fc7529cfe4..cdbcb0e17b 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2007012500; // YYYYMMDD = date + $version = 2007013100; // YYYYMMDD = date // XY = increments within a single day $release = '1.8 dev'; // Human-friendly version name