]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-8373 Add new predefined role "Authenticated user" for all logged in users
authorskodak <skodak>
Wed, 31 Jan 2007 21:05:32 +0000 (21:05 +0000)
committerskodak <skodak>
Wed, 31 Jan 2007 21:05:32 +0000 (21:05 +0000)
admin/settings/users.php
lang/en_utf8/admin.php
lang/en_utf8/moodle.php
lang/en_utf8/role.php
lib/accesslib.php
lib/db/access.php
version.php

index dbd63a1903518927dc753cedc4c15641e62b3130..ae4185cb22326df6fec3a4b05fb249d9b7d787fd 100644 (file)
@@ -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));
 
index 99a74365ebd8cd46c7ff26473ba0f9bc1bcf12a4..e44e0b8601068a4604555b9c0f3daa6652ec5971 100644 (file)
@@ -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 <strong>hotmail.com yahoo.co.uk</strong>';
 $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).';
index 2ea6213708dd0908e692fdebb1614c680df433cb..108d6d82ac7cd8a808b536325bf4ce0a7eb6a54e 100644 (file)
@@ -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';
index aa74f0353f430cdefde07b99a59b1d0dc1913edf..71f0c12190dbe522b567ba51667886ea50612ad8 100644 (file)
@@ -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.';
index da9654e0a07bed99d4b1aa518d4e515dd43d1013..cde7ab51fe4a779af22c12675c8d67810ff05620 100755 (executable)
@@ -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
index 5f85fc966b81b2bb575c6ad8d09ebf8381683079..7fe2e915e83b0c5cd60e1356db5ecc54af698237 100644 (file)
@@ -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
         )
     ),
index fc7529cfe41fcde546bf39ccb6686f076a908ee0..cdbcb0e17b2039473660c52cb89e77960bcf889f 100644 (file)
@@ -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