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.