No longer an administrator

No longer an administrator

by Edward Gash -
Number of replies: 5

Oh dear.  While messing with the new roles in 1.7; I inadvertently changed my role from that of an administrator on my site!  I no longer have and administrator rights/options after log in.

Is this an absolute disaster - what can I do?  Thanks in advance.

Average of ratings: -
In reply to Edward Gash

Re: No longer an administrator

by Edward Gash -

Crisis averted.

I managed to access the database using phpmyadmin and I looked at what my user ID was in the mdl_users table.  In the mdl_role_assignments table, I changed a row with my user ID to have a role ID and a context ID of 1.

This reassigned me as a administrator on my site.  Phew.

In reply to Edward Gash

Re: No longer an administrator - External Database Enrollment problem?

by Piotr Majewski -
I think the problem is not totally solved.

After deleting all the roles from mdl_role_assignments and leaving only:

id,roleid,contextid,userid,hidden,timestart,timeend,timemodified,modifierid,enrol,sortorder
1,1,1,2,0,0,0,1166532607,0,manual,0

I still couldn't see admin options. I deleted everything from cache and sessions - still a problem. I uploaded changed admin/roles/assing.php file.

So I've started to think what else is wrong.

Now I know there is a problem with External Database Enrollment - I've configured it with database which doesn't exists. I think that moodle is looking for that DB and is assinging role to admin relaying on data he can't get.

If it is true I think that:
  • it should be impossible to assing a role to admin from External DB and other methods - at least one with userid = 2.
  • OR manual assign should be always priority 1
  • OR it should be possible to assing priorities to enrolment methods - this one is not the best option beacause one can make mistake he could not be able to repair without loging to phpMyAdmin
  • OR AT LEAST Moodle should not use this method if it can't find external DB.
That is my opinion of course - I was looking in forums for the same problems - did not find, but sorry if someone wrote about this before.
In reply to Piotr Majewski

Query Failed in Load User Capability

by Michelle Jimenez -

Greetings.

Im glad to hear your opinion relating to the problem im having right now in my moodle portal.

Would that mean I need to execute SQL statements via databases to make it work? Is it too much technical since im not aware of how the databases have been designed in moodle.

Hoping for your response.

Thanks.

Michelle

In reply to Piotr Majewski

Re: No longer an administrator - External Database Enrollment problem?

by William Claps -
I am having a problem with 1.7. admin was assigned the roll of student by accident and no longer has admin privileges. PHPMYADMIN shows 1's for for id, roleid, contextid, userid. Every forum post i have seen to fix the problem says to assign those numbers. But, as you can see those numbers are already assigned. Any suggestions? Thanks.

Bill
In reply to William Claps

Re: No longer an administrator - External Database Enrollment problem?

by William Claps -
I figured it out.

It seems that the administrator still had admin permissions, but was also assigned student permissions. So in PHPmyAdmin in mdl_roll_assignments, I noticed two entries for the admin user. I just deleted the second entry (which I assume was the student permission) and all is well.

Hope this post helps someone else out. I was starting to panic a little. Whew.

(I think I'll use this opportunity to backup)