Removing Roles

Removing Roles

- Claire Browne の投稿
返信数: 7

Hello,

I am in Moodle 2.2 and I want to remove two roles from a person who was enrolled via our database.

I know I can delete the two roles because there are crosses next to the role name, but when I save the changes do not save and the roles are present again.

Has anyone else come across this problem?

Claire Browne への返信

Re: Removing Roles

- Helen Foster の投稿
画像 Core developers 画像 Documentation writers 画像 Moodle HQ 画像 Particularly helpful Moodlers 画像 Plugin developers 画像 Testers 画像 Translators

Hi Claire,

Was the user assigned the roles via the external database enrolment? If so, you'll need to remove it there.

Helen Foster への返信

Re: Removing Roles

- Duarte Barbosa の投稿

Hi,

So I was trying this anda did something stupid, like making the role REGISTERED USER with no rights at all (forbiden). I completley forgot that this applys to all users registered, I thought it was a normal role.. Stupid stupid.

So now I can't change anything anymore, as admin. No one can, since everyone has no rights at all.

How can I change this, can anyone help me?

悲しい

Duarte Barbosa への返信

Re: Removing Roles

- Guillermo Madero の投稿

Hi Duarte,

You don't mention which Moodle version you are using, but I'm sure you must be working with some 1.9.x version (because the admin role works differently in 2.x).

I guess you don't have a full backup that you could use to restore your site, do you?

Anyway, don't worry, as you'll be able to fix this in a few easy steps 笑顔 (assuming that you are working with a MySQL database and that you can access it via phpMyAdmin), but first, some background info...

The mdl_role_capabilities table has 13 registers (on a 1.9.13+ Moodle installation, and 50 on 2.0.4+ installation) for an unaltered Authenticated user role (roleid=7).

When a capability is set to:

* Not set, the corresponding register is deleted.
* Allow, the permission field is set to 1.
* Prevent, the permission field is set to -1.
* Prohibit, the permission field is set to -1000

So, to fix this problem:

1. Go into your phpMyAdmin, select your database and the mdl_role_capabilities table.

2. Click on the SQL tab and enter the following query:

UPDATE `mdl_role_capabilities`
SET `permission`='1'
WHERE `contextid` = '1'
AND `roleid` = '7';

3. Click on the Go button.

4. Now log into your Moodle installation.

5. Go to Define roles page (Administration > Users > Permissions > Define roles).

6. Select the Authenticated user role.

7. On the View role details page, select the Reset to defaults button, and finally click on Yes.

Though it was no fun setting the 223 capabilities of the authenticated user to Prohibit, it was interesting to see the behavior of the installation, and I could also confirm that this solution works.

Cheers!

Guillermo Madero への返信

Re: Removing Roles

- Duarte Barbosa の投稿

Thanks a lot!

No, I did not have a backup, and yes moodle version is 1.9, but I'm just trying moodle, setting up things, testing.. it's not, yet, working for others. So, if I didn't had your help, I was just gonna start all over again. I just needed to know wich table had those definitions and what to change, so again, thanks a lot for making my work yeasier. Although I wasn't able to find that reset button, but no worries, i've changed all settings one by one.

Again, thanks 笑顔

Duarte Barbosa への返信

Re: Removing Roles

- Guillermo Madero の投稿

Nice to now it worked, and better yet, that it was not a critical situation.

The Reset to defaults button is on the View page, not on the Edit page, this means you must select the role (as if to see its permissions), not edit it.

In real life situations, always remember to backup 笑顔

Guillermo Madero への返信

Re: Removing Roles

- Duarte Barbosa の投稿

Yes, I found it later on, bt no worries.

And yes, I know I need backups, but like you said, it wasn't critical. 笑顔

btw, do you know how to set up the HTTPS login? My web serve is supposed to have a HTTPS key that comes with the service I have, but I don't really know how to use it to test it.  They have PLESK to access the domain settings, I can see a HTTPS folder within the server space I have, is it just a copy past into that folder? Should I do some other configuration?

If you could help, it would be great 笑顔