Lost the administrator's privilege totally

Lost the administrator's privilege totally

by Joanna Tsai -
Number of replies: 8

I changed the access role "guest" to "authenticated user(default)" in the page of the course general setting 1 hr ago, then I wanted to know if it worked, then logged out, click the course name, it popped up  the dialogue box "You are about to enrol yourself as a member of this course.
Are you sure you wish to do this?"

Confirm yes, it stilled printed this dialogue box again and again, then I logged in as the administrator, the same situation occurred, and the "Turn editing on" option is missing and i am unable to litterally anything...Just can view the main page, the block of admin still unable to access,  denied everywhere.

I've searched the forum, have uploaded Petr's script in this page http://moodle.org/mod/forum/discuss.php?d=66281, it didn't change.

I read this post http://moodle.org/mod/forum/discuss.php?d=98036, the table mdl_user, can not find the admin user, still not resolved,  please give me some instruction as I didnot backup the students information and course totally, Must I reinstall the moodle? I use 1.8.2, thanks in advance.

Average of ratings: -
In reply to Joanna Tsai

Re: Lost the administrator's privilege totally

by Joanna Tsai -

I remind I modified the role policy of the authenticated user,  while I think I allow the privilege of overriding, maybe that caused the confusion. However, the default role for new users is 'authenticated user'. Oh, god,am I so stupid!?

Does anyone know how to modified the overriding confliction in mysql or somewhere?

In reply to Joanna Tsai

Re: Lost the administrator's privilege totally

by Joanna Tsai -

I've excuted the sql syntax as instructed in the post http://moodle.org/mod/forum/discuss.php?d=65466&parent=295359, the miracle doesn't happen, but I will keep on searching and restoring.

I think it is just the role policy problem. It should be some way that let us reset the role policy to the default situation even if you can not use your administrative panel, maybe change some php files or some database, oh, really a hard way in jungle!

My roledebug.php result, thanks for viewing.

Attachment PROBLEM.jpg
In reply to Joanna Tsai

Re: Lost the administrator's privilege totally

by John Isner -
Oops, the role debugger only works with version 1.9 and I see you're running 1.8. But it gave us the information we need!

You must reset two user policies that you changed. You currently have
  • Role for guest = Authenticated user
  • Default role for users in a course = Authenticated user
The values should be:
  • Role for guest = Guest
  • Default role for users in a course = Student
You can do this by adding the following two lines somewhere in your config.php file (the file in the moodle root directory):

$CFG->guestroleid = 6;
$CFG->defaultcourseroleid = 5;

Then login as admin, go to Site administration -> Users -> Permissions -> User policies and reset the above two user policies back to what they should be.

After doing this you can remove the two lines from your config.php file. And please don't change user policies in the future!

Let us know how it works out.
In reply to John Isner

Re: Lost the administrator's privilege totally

by Joanna Tsai -

Hi, John

Thanks a lot for your warm-hearted suggestion, which it helps me so much.

Let me describe step by step so that it can help others who meet the same problem.

1. I have modified the two line

"$CFG->guestroleid = 6;
$CFG->defaultcourseroleid = 5;"

Uploaded and overwrited the original one, but it does not play the trick, yet I didn't give up, and found another method in this post http://moodle.org/mod/forum/discuss.php?d=87414#p387916

2. I logged in the phpmyadmin panel

found the mdl_config

browsed the table

the string "defaultuserroleid" was found, editted it to 1

also modify "guestroleid = 6;"
"defaultcourseroleid = 5;"

opened IE, input my website, logged in as admin, the panel is back, all the funtion of management is normal, I can view courses and the guests also can do.

3.Go to Site administration -> Users -> Permissions -> User policies

Change Default role for all users to Authenticated user instead of administrator.

Done!

The attachment will be demonstrated the change.

Thank you! John So glad that wanna give you a hug!

Regards,

Attachment first.jpg
In reply to Joanna Tsai

Re: Lost the administrator's privilege totally

by Joanna Tsai -
set back to authenticated user, the database showed
Attachment later.jpg
In reply to Joanna Tsai

Re: Lost the administrator's privilege totally

by Erika Moreira -
Liu, I need your help please, I'm really at very hard situation. I'm venezuelan, for that, my english is very bad!

I was read your post, and when I was found in my database the table mdl_config not there the string: "defaultuserroleid", I think that it is because, I was restringed ALL privileges to a "authenticated user" if you can, help me please!!
In reply to Erika Moreira

Re: Lost the administrator's privilege totally

by Clinton Randolph -

Erika,

I did the exact same thing about two weeks ago.  And like you was in a panic.  Look at the thread here: http://moodle.org/mod/forum/discuss.php?d=103512 and read through it. It should point you in the right direction.  It took me a couple of days to work through it.  I finally had to go into Myphp and edit the permissions there.  Then when I could login, I went back and changed all my users to the default setting.

In reply to Joanna Tsai

Re: Lost the administrator's privilege totally

by Eyvonne King -
If you have worked out this problem maybe you can help me I'm the administratior and I'm locked out of my site and can't do anything but look at the name and syllabus of my courses.