mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
uploading of users has new capability 'moodle/user:upload' now also with admin block integrated
This commit is contained in:
parent
0c19750c72
commit
cc891abe88
4 changed files with 31 additions and 17 deletions
|
@ -10,7 +10,7 @@ $ADMIN->add('users', new admin_externalpage('userauthentication', get_string('au
|
||||||
$ADMIN->add('users', new admin_category('accounts', get_string('accounts', 'admin')));
|
$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('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('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
|
// stuff under the "roles" subcategory
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
|
|
||||||
require_once('../config.php');
|
require_once('../config.php');
|
||||||
require_once($CFG->libdir.'/uploadlib.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);
|
$createpassword = optional_param('createpassword', 0, PARAM_BOOL);
|
||||||
$updateaccounts = optional_param('updateaccounts', 0, PARAM_BOOL);
|
$updateaccounts = optional_param('updateaccounts', 0, PARAM_BOOL);
|
||||||
|
@ -12,7 +15,7 @@ $allowrenames = optional_param('allowrenames', 0, PARAM_BOOL);
|
||||||
|
|
||||||
require_login();
|
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()) {
|
if (! $site = get_site()) {
|
||||||
error("Could not find site-level course");
|
error("Could not find site-level course");
|
||||||
|
@ -22,15 +25,12 @@ if (!$adminuser = get_admin()) {
|
||||||
error("Could not find site admin");
|
error("Could not find site admin");
|
||||||
}
|
}
|
||||||
|
|
||||||
$streditmyprofile = get_string("editmyprofile");
|
$strfile = get_string('file');
|
||||||
$stradministration = get_string("administration");
|
$struser = get_string('user');
|
||||||
$strfile = get_string("file");
|
$strusersnew = get_string('usersnew');
|
||||||
$struser = get_string("user");
|
$strusersupdated = get_string('usersupdated');
|
||||||
$strusers = get_string("users");
|
$struploadusers = get_string('uploadusers');
|
||||||
$strusersnew = get_string("usersnew");
|
$straddnewuser = get_string('importuser');
|
||||||
$strusersupdated = get_string("usersupdated");
|
|
||||||
$struploadusers = get_string("uploadusers");
|
|
||||||
$straddnewuser = get_string("importuser");
|
|
||||||
|
|
||||||
$csv_encode = '/\&\#44/';
|
$csv_encode = '/\&\#44/';
|
||||||
if (isset($CFG->CSV_DELIMITER)) {
|
if (isset($CFG->CSV_DELIMITER)) {
|
||||||
|
@ -47,9 +47,7 @@ if (isset($CFG->CSV_DELIMITER)) {
|
||||||
|
|
||||||
/// Print the header
|
/// Print the header
|
||||||
|
|
||||||
print_header("$site->shortname: $struploadusers", $site->fullname,
|
admin_externalpage_print_header($adminroot);
|
||||||
"<a href=\"index.php\">$stradministration</a> ->
|
|
||||||
<a href=\"users.php\">$strusers</a> -> $struploadusers");
|
|
||||||
|
|
||||||
|
|
||||||
/// If a file has been uploaded, then process it
|
/// If a file has been uploaded, then process it
|
||||||
|
@ -407,7 +405,7 @@ echo '<input type="submit" value="'.$struploadusers.'">';
|
||||||
echo '</form><br />';
|
echo '</form><br />';
|
||||||
echo '</center>';
|
echo '</center>';
|
||||||
|
|
||||||
print_footer();
|
admin_externalpage_print_footer($adminroot);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,23 @@ $moodle_capabilities = array(
|
||||||
|
|
||||||
'moodle/user:update' => array(
|
'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',
|
'captype' => 'write',
|
||||||
'contextlevel' => CONTEXT_SYSTEM,
|
'contextlevel' => CONTEXT_SYSTEM,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// This is compared against the values stored in the database to determine
|
// This is compared against the values stored in the database to determine
|
||||||
// whether upgrades should be performed (see lib/db/*.php)
|
// whether upgrades should be performed (see lib/db/*.php)
|
||||||
|
|
||||||
$version = 2006092400; // YYYYMMDD = date
|
$version = 2006092403; // YYYYMMDD = date
|
||||||
// XY = increments within a single day
|
// XY = increments within a single day
|
||||||
|
|
||||||
$release = '1.7 dev'; // Human-friendly version name
|
$release = '1.7 dev'; // Human-friendly version name
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue