MDL-26140 hide unfinished experimental DTL pages
[moodle.git] / admin / settings / users.php
CommitLineData
11b749ca 1<?php
50999a0b 2
3// This file defines settingpages and externalpages under the "users" category
4
d86f4473 5$ADMIN->add('users', new admin_category('accounts', get_string('accounts', 'admin')));
6$ADMIN->add('users', new admin_category('roles', get_string('permissions', 'role')));
7
fc4069d6 8if ($hassiteconfig
9 or has_capability('moodle/site:uploadusers', $systemcontext)
10 or has_capability('moodle/user:create', $systemcontext)
11 or has_capability('moodle/user:update', $systemcontext)
61d04bcc 12 or has_capability('moodle/user:delete', $systemcontext)
13 or has_capability('moodle/role:manage', $systemcontext)
864e2805
PS
14 or has_capability('moodle/role:assign', $systemcontext)
15 or has_capability('moodle/cohort:manage', $systemcontext)
16 or has_capability('moodle/cohort:view', $systemcontext)) { // speedup for non-admins, add all caps used on this page
7d0c81b3 17
50999a0b 18
1caea91e 19 if (empty($CFG->loginhttps)) {
220a90c5 20 $securewwwroot = $CFG->wwwroot;
21 } else {
22 $securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
23 }
24 // stuff under the "accounts" subcategory
220a90c5 25 $ADMIN->add('accounts', new admin_externalpage('editusers', get_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
26 $ADMIN->add('accounts', new admin_externalpage('userbulk', get_string('userbulk','admin'), "$CFG->wwwroot/$CFG->admin/user/user_bulk.php", array('moodle/user:update', 'moodle/user:delete')));
27 $ADMIN->add('accounts', new admin_externalpage('addnewuser', get_string('addnewuser'), "$securewwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
6c7a5df7 28 $ADMIN->add('accounts', new admin_externalpage('uploadusers', get_string('uploadusers', 'admin'), "$CFG->wwwroot/$CFG->admin/uploaduser.php", 'moodle/site:uploadusers'));
b352b2e9 29 $ADMIN->add('accounts', new admin_externalpage('uploadpictures', get_string('uploadpictures','admin'), "$CFG->wwwroot/$CFG->admin/uploadpicture.php", 'moodle/site:uploadusers'));
220a90c5 30 $ADMIN->add('accounts', new admin_externalpage('profilefields', get_string('profilefields','admin'), "$CFG->wwwroot/user/profile/index.php", 'moodle/site:config'));
864e2805 31 $ADMIN->add('accounts', new admin_externalpage('cohorts', get_string('cohorts', 'cohort'), $CFG->wwwroot . '/cohort/index.php', array('moodle/cohort:manage', 'moodle/cohort:view')));
220a90c5 32
33
34 // stuff under the "roles" subcategory
220a90c5 35
36 // "userpolicies" settingpage
37 $temp = new admin_settingpage('userpolicies', get_string('userpolicies', 'admin'));
38 if ($ADMIN->fulltree) {
31a99877 39 if (!during_initial_install()) {
220a90c5 40 $context = get_context_instance(CONTEXT_SYSTEM);
4f0c2d00
PS
41 $allroles = array();
42 $generalroles = array();
43 $guestroles = array();
44 $userroles = array();
45 $studentroles = array();
46 $teacherroles = array();
47 $creatornewroles = array();
df997f84 48
4f0c2d00
PS
49 foreach (get_all_roles() as $role) {
50 $rolename = strip_tags(format_string($role->name)) . ' ('. $role->shortname . ')';
51 $allroles[$role->id] = $rolename;
52 switch ($role->archetype) {
53 case 'manager':
54 $creatornewroles[$role->id] = $rolename;
55 break;
56 case 'coursecreator':
57 break;
58 case 'editingteacher':
59 $teacherroles[$role->id] = $rolename;
60 $creatornewroles[$role->id] = $rolename;
61 break;
62 case 'teacher':
63 $creatornewroles[$role->id] = $rolename;
64 break;
65 case 'student':
66 $studentroles[$role->id] = $rolename;
67 break;
68 case 'guest':
69 $guestroles[$role->id] = $rolename;
70 break;
71 case 'user':
72 $userroles[$role->id] = $rolename;
73 break;
74 case 'frontpage':
75 break;
76 default:
77 $creatornewroles[$role->id] = $rolename;
78 $generalroles[$role->id] = $rolename;
79 break;
220a90c5 80 }
81 }
11b749ca 82
4f0c2d00
PS
83 reset($guestroles);
84 $defaultguestid = key($guestroles);
85 reset($studentroles);
86 $defaultstudentid = key($studentroles);
87 reset($teacherroles);
88 $defaultteacherid = key($teacherroles);
df997f84 89
4f0c2d00
PS
90 if ($userroles) {
91 reset($userroles);
92 $defaultuserid = key($userroles);
93 } else {
94 $userroles = array('0'=>get_string('none'));
95 $defaultuserid = 0;
220a90c5 96 }
97
98 $temp->add(new admin_setting_configselect('notloggedinroleid', get_string('notloggedinroleid', 'admin'),
4f0c2d00 99 get_string('confignotloggedinroleid', 'admin'), $defaultguestid, ($guestroles + $generalroles)));
220a90c5 100 $temp->add(new admin_setting_configselect('guestroleid', get_string('guestroleid', 'admin'),
f0a25c37 101 get_string('guestroleid_help', 'admin'), $defaultguestid, ($guestroles + $generalroles)));
220a90c5 102 $temp->add(new admin_setting_configselect('defaultuserroleid', get_string('defaultuserroleid', 'admin'),
4f0c2d00 103 get_string('configdefaultuserroleid', 'admin'), $defaultuserid, ($userroles + $generalroles)));
220a90c5 104 }
69833712 105
220a90c5 106 $temp->add(new admin_setting_configcheckbox('nodefaultuserrolelists', get_string('nodefaultuserrolelists', 'admin'), get_string('confignodefaultuserrolelists', 'admin'), 0));
69833712 107
31a99877 108 if (!during_initial_install()) {
220a90c5 109 $temp->add(new admin_setting_configselect('creatornewroleid', get_string('creatornewroleid', 'admin'),
25b355b6 110 get_string('creatornewroleid_help', 'admin'), $defaultteacherid, $creatornewroles));
220a90c5 111 }
69833712 112
220a90c5 113 $temp->add(new admin_setting_configcheckbox('autologinguests', get_string('autologinguests', 'admin'), get_string('configautologinguests', 'admin'), 0));
8f8ed475 114
220a90c5 115 $temp->add(new admin_setting_configmultiselect('hiddenuserfields', get_string('hiddenuserfields', 'admin'),
116 get_string('confighiddenuserfields', 'admin'), array(),
117 array('description' => get_string('description'),
118 'city' => get_string('city'),
119 'country' => get_string('country'),
120 'webpage' => get_string('webpage'),
121 'icqnumber' => get_string('icqnumber'),
122 'skypeid' => get_string('skypeid'),
123 'yahooid' => get_string('yahooid'),
124 'aimid' => get_string('aimid'),
125 'msnid' => get_string('msnid'),
1263a0ff 126 'firstaccess' => get_string('firstaccess'),
53bd2255 127 'lastaccess' => get_string('lastaccess'),
c6b4179c 128 'mycourses' => get_string('mycourses'),
129 'groups' => get_string('groups'))));
99cd2f77 130
131 $temp->add(new admin_setting_configmulticheckbox('extrauserselectorfields',
132 get_string('extrauserselectorfields', 'admin'), get_string('configextrauserselectorfields', 'admin'), array('email' => '1'),
133 array('email' => get_string('email'), 'idnumber' => get_string('idnumber'), 'username' => get_string('username'), )));
c785d40a 134 }
4766a50c 135
220a90c5 136 $ADMIN->add('roles', $temp);
8f8ed475 137
4f0c2d00
PS
138 if (is_siteadmin()) {
139 $ADMIN->add('roles', new admin_externalpage('admins', get_string('siteadministrators', 'role'), "$CFG->wwwroot/$CFG->admin/roles/admins.php"));
140 }
44079dfe 141 $ADMIN->add('roles', new admin_externalpage('defineroles', get_string('defineroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/manage.php", 'moodle/role:manage'));
8a8272b0 142 $ADMIN->add('roles', new admin_externalpage('assignroles', get_string('assignglobalroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=".$systemcontext->id, 'moodle/role:assign'));
bed9cec8 143 $ADMIN->add('roles', new admin_externalpage('checkpermissions', get_string('checkglobalpermissions', 'role'), "$CFG->wwwroot/$CFG->admin/roles/check.php?contextid=".$systemcontext->id, array('moodle/role:assign', 'moodle/role:safeoverride', 'moodle/role:override', 'moodle/role:manage')));
8a8272b0 144
a559f630 145} // end of speedup