$ADMIN->add('users', new admin_category('accounts', get_string('accounts', 'admin')));
$ADMIN->add('accounts', new admin_externalpage('editusers', get_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
$ADMIN->add('accounts', new admin_externalpage('addnewuser', get_string('addnewuser'), "$CFG->wwwroot/$CFG->admin/user.php?newuser=true", 'moodle/user:create'));
-$ADMIN->add('accounts', new admin_externalpage('uploadusers', get_string('uploadusers'), "$CFG->wwwroot/$CFG->admin/uploaduser.php"));
+$ADMIN->add('accounts', new admin_externalpage('uploadusers', get_string('uploadusers'), "$CFG->wwwroot/$CFG->admin/uploaduser.php", 'moodle/user:upload'));
// stuff under the "roles" subcategory
require_once('../config.php');
require_once($CFG->libdir.'/uploadlib.php');
+require_once($CFG->libdir.'/adminlib.php');
+$adminroot = admin_get_root();
+admin_externalpage_setup('uploadusers', $adminroot);
$createpassword = optional_param('createpassword', 0, PARAM_BOOL);
$updateaccounts = optional_param('updateaccounts', 0, PARAM_BOOL);
require_login();
-require_capability('moodle/user:create', get_context_instance(CONTEXT_SYSTEM, SITEID));
+require_capability('moodle/user:upload', get_context_instance(CONTEXT_SYSTEM, SITEID));
if (! $site = get_site()) {
error("Could not find site-level course");
error("Could not find site admin");
}
-$streditmyprofile = get_string("editmyprofile");
-$stradministration = get_string("administration");
-$strfile = get_string("file");
-$struser = get_string("user");
-$strusers = get_string("users");
-$strusersnew = get_string("usersnew");
-$strusersupdated = get_string("usersupdated");
-$struploadusers = get_string("uploadusers");
-$straddnewuser = get_string("importuser");
+$strfile = get_string('file');
+$struser = get_string('user');
+$strusersnew = get_string('usersnew');
+$strusersupdated = get_string('usersupdated');
+$struploadusers = get_string('uploadusers');
+$straddnewuser = get_string('importuser');
$csv_encode = '/\&\#44/';
if (isset($CFG->CSV_DELIMITER)) {
/// Print the header
-print_header("$site->shortname: $struploadusers", $site->fullname,
- "<a href=\"index.php\">$stradministration</a> ->
- <a href=\"users.php\">$strusers</a> -> $struploadusers");
+admin_externalpage_print_header($adminroot);
/// If a file has been uploaded, then process it
echo '</form><br />';
echo '</center>';
-print_footer();
+admin_externalpage_print_footer($adminroot);
'moodle/user:update' => array(
- 'riskbitmask' => RISK_SPAM,
+ 'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
+
+ 'captype' => 'write',
+ 'contextlevel' => CONTEXT_SYSTEM,
+ 'legacy' => array(
+ 'guest' => CAP_PREVENT,
+ 'student' => CAP_PREVENT,
+ 'teacher' => CAP_PREVENT,
+ 'editingteacher' => CAP_PREVENT,
+ 'coursecreator' => CAP_PREVENT,
+ 'admin' => CAP_ALLOW
+ )
+ ),
+
+ 'moodle/user:upload' => array(
+
+ 'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,