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('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
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
|
||||
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);
|
||||
|
@ -12,7 +15,7 @@ $allowrenames = optional_param('allowrenames', 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");
|
||||
|
@ -22,15 +25,12 @@ if (!$adminuser = get_admin()) {
|
|||
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)) {
|
||||
|
@ -47,9 +47,7 @@ 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
|
||||
|
@ -407,7 +405,7 @@ echo '<input type="submit" value="'.$struploadusers.'">';
|
|||
echo '</form><br />';
|
||||
echo '</center>';
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -294,7 +294,23 @@ $moodle_capabilities = 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',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
|
|
|
@ -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 = 2006092400; // YYYYMMDD = date
|
||||
$version = 2006092403; // YYYYMMDD = date
|
||||
// XY = increments within a single day
|
||||
|
||||
$release = '1.7 dev'; // Human-friendly version name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue