Cannot remove users from system-wide Course Creator

Re: Cannot remove users from system-wide Course Creator

by Igor Rejlek -
Number of replies: 1

Hallo,
I just had somewhat similar issue and I think I may have found a less painful workaround.

My problem: using Moodle 2.5, when you setup course  creators LDAP group in LDAP server settings, log-in as user in the LDAP group and then clean the field in LDAP settings, the user will still be course creator when he logs in again.

When creators LDAP group is changed to some other, in which the user, who formerly was creator, is not, then on his next log-in the creators privilege is revoked from him. Don't know how it behaves, when user is just removed from the LDAP group, so I cannot confirm I have very same problem like you.

My workaround: Simply delete role_assignment row in database. Seems to work. Since Moodle was developed for MySQL, I guess it wouldn't stop me if I was breaking any referential integrity (and checking all_constraints view in DB confirms it), but the installation to which I did this, seems to be working fine.

The SQL I used (written for Oracle, Moodles schema name is MOODLE_B):
delete from MOODLE_B.m_role_assignments
where id in (
  select ra.id
  from MOODLE_B.m_user u
  join MOODLE_b.m_role_assignments ra
    on u.id = ra.userid
  join MOODLE_B.m_role r
    on r.id = ra.roleid
  where
    u.username = 'username of no-more-coursre-creator'
    and r.shortname = 'coursecreator'
);

 

In reply to Igor Rejlek

Re: Cannot remove users from system-wide Course Creator

by Dave Stone -


I'm not is a position to run database queries to clean this up.

What would happen if I copied the 'course creator' role, then deleted the original role,
and then changed the copy's shortname to the original's shortname?

Would Moodle treat the replacement role as the original, or would it cause problems?
Maybe we should never delete the default roles?