Jump to content

Recommended Posts

Posted

I've asked the question on the moodle forum but I'd ask you lot anyway :)

 

New to Moodle so hopefully just my error somewhere.

 

Whenever I assign a user to the site course creator role, as soon as they have logged in and out moodle decides to remove them from that role.

 

It seems to stick when giving the creator role in a course, but that is no use when staff need to be able to create the course in the first place.

 

New Install - Currently using 1.7, with latest Php, apache & MySQL 0n a Win2k3 Box. LDAP authentication which works fine.

 

Any pointers would be useful - none of the roles have been edited in any way.

Posted

It could be that :oops:

 

At the moment it reads

 

cn=teachers,ou-Staff,o=scgsnet

 

does 'cn' need to read 'Course Creator' ?

 

*Edit* I just tried with cn=Course creator and the user is still kicked out after logging off :(

Posted

The way you have it set at the moment is that anyone in the 'teachers' group in the 'staff' OU in the dns domain 'scgsnet' will be a Course Creator. Anyone who isn't can not be a Course Creator and will have their Course Creator access removed, unless they are an Admin.

 

Is that what you intend?

Posted
Setting ldap_creators seems to override the manual assignment. Try removing it.

 

I just did that and .............. no change :(

 

All the other roles seem to work fine. It's only the course creator that is causing the problem.

Posted
The way you have it set at the moment is that anyone in the 'teachers' group in the 'staff' OU in the dns domain 'scgsnet' will be a Course Creator. Anyone who isn't can not be a Course Creator and will have their Course Creator access removed, unless they are an Admin.

 

Is that what you intend?

 

That's right.

 

Now the confession :oops: I forgot to create the teachers group in the Staff OU :oops:

 

However - it's there now, and members added :) It's still kicking the member of staff out of the Course creator when logging off :(

 

I'll upgrade to the 1.8 beta - at the risk of killing everything :) - I'll post the result .

Posted

Upgraded to 1.8 beta and the problem is still there.

 

Next option is to create a similar role to replace Course creator and see if that works.

 

@ Geoff - I saw that, but it made no difference.

Posted
Are you sure you've not got any legacy roles selected?

 

Yep :)

 

Just created an identical role called Course-Admin - and that works perfectly. Even with legacy roles selected.

 

All I need to work out now is what I need to edit so when my course creators log in for the first time they are assigned the Course admin role instead of the Course creator role?

 

I can try and sort out the course creator role out when I have more time :)

Posted
All I need to work out now is what I need to edit so when my course creators log in for the first time they are assigned the Course admin role instead of the Course creator role?

 

I just looked at the LDAP PHP. It works by finding the first role with the "moodle/legacy:coursecreator" role set. If you remove this role from your Course Creators role then the LDAP auth will skip it and pick up your new role instead.

 

Here's the relevant chunk of code:

 

            if ($creatorroles = get_roles_with_capability('moodle/legacy:coursecreator', CAP_ALLOW)) {

               $creatorrole = array_shift($creatorroles);      // We can only use one, let's use the first one

               begin_sql();
               $xcount=0; $maxxcount=100;
               foreach ($users as $user) {
                   echo "updating user $user->username \n";
                   auth_ldap_update_user_record($user->username, $updatekeys);

                   // update course creators
                   if (!empty($CFG->ldap_creators) && !empty($CFG->ldap_memberattribute) ) {
                       if (auth_iscreator($user->username)) {   // Following calls will not create duplicates
                           role_assign($creatorrole->id, $user->id, 0, $sitecontext->id, 0, 0, 0, 'ldap');
                           $xcount++;
                       } else {
                           role_unassign($creatorrole->id, $user->id, 0, $sitecontext->id);
                           $xcount++;
                       }
                   }

                   if ($xcount++ > $maxxcount) {
                       commit_sql();
                       begin_sql();
                       $xcount=0;
                   }
               }
               commit_sql();
               unset($users); // free mem
           }

Posted

I'm not sure what you mean by 'remove the course creator role.

 

Do you mean delete it from moodle via the admin >define roles page then edit the above code to read

if ($creatorroles = get_roles_with_capability('moodle/legacy:course_admin', CAP_ALLOW) ) {

 

You may have guessed that scripty things are not my strong point :)

Posted

OK did that.

 

Now I'm back at square 1.

 

The user gets kicked out of the new Course Admin role after logging off.

 

One thing I noticed was that when deleting the course creator role it stated that there were still 7 users assigned to it even though the admin pages listed none.

 

Any other ideas?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...