diff --git a/admin/roles/assign.php b/admin/roles/assign.php
index 8c40b3f3bd9..552a89a8a5c 100755
--- a/admin/roles/assign.php
+++ b/admin/roles/assign.php
@@ -54,11 +54,6 @@
$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()) {
@@ -151,4 +146,4 @@
}
print_footer($course);
-?>
\ No newline at end of file
+?>
diff --git a/backup/backup.php b/backup/backup.php
index 703e77b577b..b3dd830d8ba 100644
--- a/backup/backup.php
+++ b/backup/backup.php
@@ -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,
diff --git a/backup/restore.php b/backup/restore.php
index e26cecd4431..19962863dbc 100644
--- a/backup/restore.php
+++ b/backup/restore.php
@@ -115,8 +115,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: $strcourserestore", $site->fullname,
diff --git a/blocks/admin/block_admin.php b/blocks/admin/block_admin.php
index 90ae5f3024e..9ed1226fd87 100644
--- a/blocks/admin/block_admin.php
+++ b/blocks/admin/block_admin.php
@@ -232,7 +232,7 @@ class block_admin extends block_list {
}
$this->content->icons[]='';
- if (is_internal_auth() && !is_restricted_user($USER->username)) {
+ if (is_internal_auth()) {
$this->content->items[]=''.get_string('changepassword').'';
$this->content->icons[]='
';
}
diff --git a/config-dist.php b/config-dist.php
index c34ef3c281f..10a9f848770 100644
--- a/config-dist.php
+++ b/config-dist.php
@@ -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';
diff --git a/course/edit.php b/course/edit.php
index cc823a8922d..22fe0b3c7e3 100644
--- a/course/edit.php
+++ b/course/edit.php
@@ -57,12 +57,6 @@
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);
diff --git a/course/enrol.php b/course/enrol.php
index 521aca26c3d..fae35e88d9c 100644
--- a/course/enrol.php
+++ b/course/enrol.php
@@ -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))) {
diff --git a/course/importstudents.php b/course/importstudents.php
index f19a28529a9..3955ed394a7 100644
--- a/course/importstudents.php
+++ b/course/importstudents.php
@@ -51,10 +51,6 @@
"id\">$course->shortname -> $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
diff --git a/course/loginas.php b/course/loginas.php
index 02b128d23ea..623df4527ae 100644
--- a/course/loginas.php
+++ b/course/loginas.php
@@ -50,8 +50,6 @@
error("Only teachers can use this page!");
}
- check_for_restricted_user($USER->username, "$CFG->wwwroot/user/view.php?id=$user&course=$course->id");
-
// validate loginaspassword if defined in config.php
if (empty($SESSION->loginasvalidated) && !empty($CFG->loginaspassword)) {
diff --git a/course/student.php b/course/student.php
index 3afd18f3ee5..773b0e1bdbb 100644
--- a/course/student.php
+++ b/course/student.php
@@ -55,10 +55,6 @@
"id\">$course->shortname -> $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
diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index 845344b7944..80d6fb718b6 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -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;
diff --git a/login/change_password.php b/login/change_password.php
index bc8dabf9008..3ed48e204d9 100644
--- a/login/change_password.php
+++ b/login/change_password.php
@@ -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)) {
diff --git a/mod/wiki/admin.php b/mod/wiki/admin.php
index de78172d865..a7d4e9203d0 100644
--- a/mod/wiki/admin.php
+++ b/mod/wiki/admin.php
@@ -124,7 +124,6 @@
/// 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="";
diff --git a/user/edit.php b/user/edit.php
index 282e1900aee..613725607d8 100644
--- a/user/edit.php
+++ b/user/edit.php
@@ -86,10 +86,6 @@
}
}
- 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);
}
diff --git a/user/view.php b/user/view.php
index 46af7fc767a..523cc51e5fd 100644
--- a/user/view.php
+++ b/user/view.php
@@ -300,7 +300,7 @@
// Print other functions
echo '