]> git.mjollnir.org Git - moodle.git/commitdiff
Removed all of the "Restricted users" hack because Roles can do it all better.
authormoodler <moodler>
Sun, 13 Aug 2006 07:01:57 +0000 (07:01 +0000)
committermoodler <moodler>
Sun, 13 Aug 2006 07:01:57 +0000 (07:01 +0000)
15 files changed:
admin/roles/assign.php
backup/backup.php
backup/restore.php
blocks/admin/block_admin.php
config-dist.php
course/edit.php
course/enrol.php
course/importstudents.php
course/loginas.php
course/student.php
lib/moodlelib.php
login/change_password.php
mod/wiki/admin.php
user/edit.php
user/view.php

index 8c40b3f3bd934eb4fcbf7ec8413ee87dec4345a0..552a89a8a5c2a4cc31957b3c0c40e7beaafca451 100755 (executable)
     $tabsmode = 'assign';
     include_once('tabs.php');
     
-/// Don't allow restricted teachers to even see this page (because it contains
-/// a lot of email addresses and access to all student on the server
-
-    check_for_restricted_user($USER->username, $CFG->wwwroot);
-
 /// Print a help notice about the need to use this page
 
     if (!$frm = data_submitted()) {
     }
     print_footer($course);
 
-?>
\ No newline at end of file
+?>
index 703e77b577bf6b69fc3b01fe3b54d79751ad7538..b3dd830d8ba8ad77d298b869e5503733903b1bee 100644 (file)
@@ -93,8 +93,6 @@
         error("Course ID was incorrect (can't find it)");
     }
 
-    check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
-
     //Print header
     if (isadmin()) {
         print_header("$site->shortname: $strcoursebackup", $site->fullname,
index e26cecd443111e30c4458be8047440aa068056f8..19962863dbc54c7fb0cdc828f78690b055ef5cf9 100644 (file)
         error("Course ID was incorrect (can't find it)");
     }
 
-    check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
-
     //Print header
     if (isadmin()) {
         print_header("$site->shortname: $strcourserestore", $site->fullname,
index 90ae5f3024e49b732667e9503b3f37b093cd6602..9ed1226fd874319bbbe918afe9d5ff19997cb26a 100644 (file)
@@ -232,7 +232,7 @@ class block_admin extends block_list {
             }
             $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
 
-            if (is_internal_auth() && !is_restricted_user($USER->username)) {
+            if (is_internal_auth()) {
                 $this->content->items[]='<a href="'.$securewwwroot.'/login/change_password.php?id='.$this->instance->pageid.'">'.get_string('changepassword').'</a>';
                 $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
             } 
index c34ef3c281f1f7ba21204e56fa404459103b39df..10a9f848770e9ac985678ccb72924aa4a706258f 100644 (file)
@@ -139,10 +139,6 @@ $CFG->admin = 'admin';
 // Useful for webhost operators who have alternate methods of backups
 //      $CFG->disablescheduledbackups = true;
 //
-// Restrict certain usernames from doing things that may mess up a site
-// This is especially useful for demonstration teacher accounts
-//      $CFG->restrictusers = 'teacher,fred,jim';
-//
 // Set global password for "Login as", teacher is prompted only once in each session.
 // Set your own password and tell it only to teachers that should have access to this feature.
 //      $CFG->loginaspassword = 'yoursharedpassword';
index cc823a8922d31cfa1c1d6ce350c6390fabda36b4..22fe0b3c7e342143f6a2b5417f54e85f85fb23f6 100644 (file)
 
     if ($form = data_submitted() and confirm_sesskey()) {
 
-        if (empty($course)) {
-            check_for_restricted_user($USER->username, "$CFG->wwwroot");
-        } else {
-            check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
-        }
-
         $form->startdate = make_timestamp($form->startyear, $form->startmonth, $form->startday);
         $form->category = clean_param($form->category, PARAM_INT);
 
index 521aca26c3d82d88a6461318e382ddeaac6e4c6d..fae35e88d9c2163272966dcb91db7ffef0b55f72 100644 (file)
@@ -20,7 +20,6 @@
         error("Could not find a site!");
     }
 
-    check_for_restricted_user($USER->username);
 
 /// Refreshing enrolment data in the USER session
     if (!($plugins = explode(',', $CFG->enrol_plugins_enabled))) {
index f19a28529a97a5b38447169ce074a172769d0110..3955ed394a747d8174cc441b7a76ff63aff3539d 100644 (file)
                  "<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $strassigncourses",
                  "studentform.searchtext");
 
-/// Don't allow restricted teachers to even see this page (because it contains
-/// a lot of email addresses and access to all student on the server
-
-    check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
 
 /// Print a help notice about the need to use this page
 
index 02b128d23ea606505a5d75593b97ffb34ac4246a..623df4527aef1a2f49b8f0053fe3eabb1207a291 100644 (file)
@@ -50,8 +50,6 @@
         error("Only teachers can use this page!");
     }
 
-    check_for_restricted_user($USER->username, "$CFG->wwwroot/user/view.php?id=$user&amp;course=$course->id");
-
     // validate loginaspassword if defined in config.php
 
     if (empty($SESSION->loginasvalidated) && !empty($CFG->loginaspassword)) {
index 3afd18f3ee5fc5b443025ddccde279cb4350fb21..773b0e1bdbb7c348db2f18e9c21d748011af87bd 100644 (file)
                  "<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $strassignstudents",
                  "studentform.searchtext");
 
-/// Don't allow restricted teachers to even see this page (because it contains
-/// a lot of email addresses and access to all student on the server
-
-    check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
 
 /// Print a help notice about the need to use this page
 
index 845344b794434664b9ccb013612476293ff2a39a..80d6fb718b63349e6e9fcccc60cebfd15b969ca2 100644 (file)
@@ -1808,46 +1808,6 @@ function reset_login_count() {
     $SESSION->logincount = 0;
 }
 
-/**
- * check_for_restricted_user
- *
- * @uses $CFG
- * @uses $USER
- * @param string $username ?
- * @param string $redirect ?
- * @todo Finish documenting this function
- */
-function check_for_restricted_user($username=NULL, $redirect='') {
-    global $CFG, $USER;
-
-    if (!$username) {
-        if (!empty($USER->username)) {
-            $username = $USER->username;
-        } else {
-            return false;
-        }
-    }
-
-    if (!empty($CFG->restrictusers)) {
-        $names = explode(',', $CFG->restrictusers);
-        if (in_array($username, $names)) {
-            error(get_string('restricteduser', 'error', fullname($USER)), $redirect);
-        }
-    }
-}
-
-function is_restricted_user($username){
-    global $CFG;
-
-    if (!empty($CFG->restrictusers)) {
-        $names = explode(',', $CFG->restrictusers);
-        if (in_array($username, $names)) {
-            return true;
-        }
-    }
-    return false;
-}
-
 function sync_metacourses() {
 
     global $CFG;
index bc8dabf90081512d03d421969a075be042282eb6..3ed48e204d986b5a177b7a22ce7316937dfb91f8 100644 (file)
@@ -21,8 +21,6 @@
     if ($frm = data_submitted()) {
         validate_form($frm, $err);
 
-        check_for_restricted_user($frm->username);
-
         update_login_count();
 
         if (!count((array)$err)) {
index de78172d865e004b3931ff88593cef929567e8b8..a7d4e9203d06da1acaaeba29cefe2f4c54ee1573 100644 (file)
     /// Check if the Form has been submitted and display confirmation
     ////////////////////////////////////////////////////////////
     if ($form = data_submitted()) {
-      check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
       /// Moodle Log
       /// Get additional info
       $addloginfo="";
index 282e1900aee1df1a6e022666c3040ef04bc06500..613725607d85cf4fe6da6b8b18755a3a08cb5d76 100644 (file)
             }   
         }   
 
-        if (isset($USER->username)) {
-            check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
-        }
-
         if (isset($usernew->password)) {
             unset($usernew->password);
         }
index 46af7fc767a6e2739b0214fc18cd2c7cff0519d2..523cc51e5fd9c01b56a62abbeede0390eaa01bc1 100644 (file)
 //  Print other functions
     echo '<div class="buttons"><table align="center"><tr>';
 
-    if ($currentuser and !isguest() and !is_restricted_user($USER->username)) {
+    if ($currentuser and !isguest()) {
         if ($internalpassword ) {
             echo "<td nowrap=\"nowrap\"><form action=\"$internalpassword\" method=\"get\">";
             echo "<input type=\"hidden\" name=\"id\" value=\"$course->id\" />";