]> git.mjollnir.org Git - moodle.git/commitdiff
uploading of users has new capability 'moodle/user:upload' now also with admin block...
authorskodak <skodak>
Sun, 24 Sep 2006 12:31:49 +0000 (12:31 +0000)
committerskodak <skodak>
Sun, 24 Sep 2006 12:31:49 +0000 (12:31 +0000)
admin/settings/users.php
admin/uploaduser.php
lib/db/access.php
version.php

index 1c78f4bfa862741c3ed5386439217d33696e120c..2ad51bbaa6aa92ccbb64bbad619b6372cbb57756 100644 (file)
@@ -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
index 5e04757823d99d936e622adf2ffe09ed8be6bbc9..4fc53dcfbc3566fdb0f128b30f178c4be26a9141 100755 (executable)
@@ -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);
 
 
 
index 2d78126e6418720ba2141493accdcc2754d47d33..61d83738fd505f297445beaf3ad1f92069451c8e 100644 (file)
@@ -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,
index 3e566fb02847453485eccebbd8c5ab59ab5a3ecb..7393efdc0b6dee0706700c4f7eb995adb9551991 100644 (file)
@@ -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