Removing Roles

Removing Roles

per Claire Browne -
Nombre de respostes: 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?

Mitjana de qualificacions: -
En resposta a Claire Browne

Re: Removing Roles

per Helen Foster -
Imatge Core developers Imatge Documentation writers Imatge Moodle HQ Imatge Particularly helpful Moodlers Imatge Plugin developers Imatge Testers Imatge Translators

Hi Claire,

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

En resposta a Helen Foster

Re: Removing Roles

per 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?

Trist

En resposta a Duarte Barbosa

Re: Removing Roles

per 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 Somrient (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!

En resposta a Guillermo Madero

Re: Removing Roles

per 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 Somrient

En resposta a Duarte Barbosa

Re: Removing Roles

per 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 Somrient

En resposta a Guillermo Madero

Re: Removing Roles

per 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. Somrient

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 Somrient