From: skodak Date: Sun, 24 Sep 2006 12:31:49 +0000 (+0000) Subject: uploading of users has new capability 'moodle/user:upload' now also with admin block... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=cc891abe885ff2f094905c9385212d1d3bb7b0fb;p=moodle.git uploading of users has new capability 'moodle/user:upload' now also with admin block integrated --- diff --git a/admin/settings/users.php b/admin/settings/users.php index 1c78f4bfa8..2ad51bbaa6 100644 --- a/admin/settings/users.php +++ b/admin/settings/users.php @@ -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 diff --git a/admin/uploaduser.php b/admin/uploaduser.php index 5e04757823..4fc53dcfbc 100755 --- a/admin/uploaduser.php +++ b/admin/uploaduser.php @@ -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, - "$stradministration -> - $strusers -> $struploadusers"); +admin_externalpage_print_header($adminroot); /// If a file has been uploaded, then process it @@ -407,7 +405,7 @@ echo ''; echo '
'; echo ''; -print_footer(); +admin_externalpage_print_footer($adminroot); diff --git a/lib/db/access.php b/lib/db/access.php index 2d78126e64..61d83738fd 100644 --- a/lib/db/access.php +++ b/lib/db/access.php @@ -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, diff --git a/version.php b/version.php index 3e566fb028..7393efdc0b 100644 --- a/version.php +++ b/version.php @@ -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