LDAP Enrollment Enabled but not available

LDAP Enrollment Enabled but not available

by jeff quinn -
Number of replies: 12
I am working a test moodle server, version: 3.7.2+ Build: 20191004

Theme: EGURU

Specifically we wanted to get LDAP enrollment up and running so we can have more control on users completion for training's put out.  The LDAP enrollment plugin has been turned on, and the settings filled out (though not 100% sure correctly). However when I made a test LDAP course, I do not have LDAP enrollment as an option (images attached).

Is the absence of LDAP enrollment due to settings not being correct? I know the version of the enrollment plugin in is: 2019052000 but so is all the other enrollment plugins which are available. 

Any ideas/reasons why I can not add LDAP enrollment to a course even though it is enabled on the server? Any help or points in the right direction is appreciated.
Attachment ldap enrollment enabled.png
Attachment ldap enrollment not available.png
Average of ratings: -
In reply to jeff quinn

Re: LDAP Enrollment Enabled but not available

by Rafel Amer -
Hello,
I have the same problem. Do you know how to solve it?

Thanks,
Rafel Amer
In reply to Rafel Amer

Re: LDAP Enrollment Enabled but not available

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
You do not need to enable ldap enrollment at the course level, it is just enabled at the site level and then the sync takes care of the rest. Have you enabled the ldap enrollment sync in scheduled tasks? Have you tested it? Try adding a user to a group that is named the same as a course idnumber and then log in as that user - they should automatically be enrolled in te course...
In reply to Emma Richardson

Re: LDAP Enrollment Enabled but not available

by Rafel Amer -
I have enabled the ldap enrollment sync in scheduled tasks and it has run one time. But I can't see the enrolments doesn't work. Maybe my LDAP data is not correct.
I attach a file with my test data in the openldap database.
It is correct o I ha to change something?

Thank you vey much.
In reply to Rafel Amer

Re: LDAP Enrollment Enabled but not available

by Rafel Amer -
I also attach the configuration of the LDAP enrollment

Thanks
In reply to Rafel Amer

Re: LDAP Enrollment Enabled but not available

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Ok, that looks ok, I think - I use MSAD so not sure how your fields transfer. In your course, the course id number field needs to match the name of your group - the groups need to be located in the same ou as your users - so you would have one group in your users OU and another group with the same name in the teachers OU...
In reply to Emma Richardson

Re: LDAP Enrollment Enabled but not available

by Rafel Amer -
Hello.

Now my groups in the openLDAP database ara:
ou=Teachers,dc=claimcenter,dc=com
ou=Students,dc=claimcenter,dc=com
ou=Managers,dc=claimcenter,dc=com
ou=Coordinators,dc=claimcenter,dc=com
ou=StudentsEnrollments,ou=Students,dc=claimcenter,dc=com
ou=TeachersEnrollments,ou=Teachers,dc=claimcenter,dc=com
cn=Maths6P,ou=StudentsEnrollments,ou=Students,dc=claimcenter,dc=com
cn=Maths6P,ou=TeachersEnrollments,ou=Teachers,dc=claimcenter,dc=com
and I have a course in Moodle with Course ID number Maths6P

The settings in the LDAP enrolment plugin are:
Role mapping:
Teacher: ou=TeachersEnrollments,ou=Teachers,dc=claimcenter,dc=com
Student: ou=StudentsEnrollments,ou=Students,dc=claimcenter,dc=com
LDAP member attribute: memberuid

But it does not works. When I log in as a student or as a teacher and I try to access the Maths6P course, I get
          You can not enrol yourself in this course


In the documentation of Moodle LDAP Enrollment HOWTO, I have one question. Where I have to set the LDAP Enrollment Variables
enrol_ldap_student_contexts
enrol_ldap_student_memberattribute
enrol_ldap_teacher_contexts
enrol_ldap_teacher_memberattribute
etc?

Thanks.
In reply to Rafel Amer

Re: LDAP Enrollment Enabled but not available

by Rafel Amer -
I can't find the variables

enrol_ldap_student_contexts
enrol_ldap_student_memberattribute
enrol_ldap_teacher_contexts
enrol_ldap_teacher_memberattribute
etc.

in any file in the /var/www/moodle directory and in any table of the moodle database.

Thanks.
In reply to Rafel Amer

Re: LDAP Enrollment Enabled but not available

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hola Rafel,

you won't find exactly those names anywhere, because they are programmatically constructed in .../enrol/ldap/settingslib.php and used from .../enrol/ldap/settings.php. Also their names changed when the plugin was changed to display the localized role names (but the documentation was never updated, it seems).

The new names are contexts_role1, contexts_role2, ... and memberattribute_role1, memberattribute_role2, etc. You can find them (and their associated values) in the database. Specifically in the mdl_config_plugins table (assuming you use mdl_ as your table prefix).

Saludos.

Iñaki.

In reply to Iñaki Arenaza

Re: LDAP Enrollment Enabled but not available

by Rafel Amer -
Hello.
Hola Iñaki.

There's one thing that I don't undestand. I put openldap slapd in debug mode and when the scheduled task
Synchronise system roles from LDAP runs, there is not any reference to StudentsEnrollments, TeachersEnrollments
or Maths6P course.
It seems that the task doesn't looks at this elements in the openldap database.

How can I see what the script auth/ldap/classes/task/sync_roles.php is doing?

Thanks.
In reply to Rafel Amer

Re: LDAP Enrollment Enabled but not available

by Rafel Amer -
Hello.

I'm sorry.
I enabled Synchronise system roles from LDAP, but not Synchronise LDAP enrolments task.
Now that I have enabled the scheduled task Synchronise LDAP enrolments, all is working fine.

Thank you very much for your help and sorry for the inconveniences.

Thank you Emma.
Gracias Iñaki. 

Rafel Amer
In reply to Rafel Amer

Re: LDAP Enrollment Enabled but not available

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Try switching your role mapped to the ou that your teachers are in, not the security group ou. The enrollment variables are what you are setting on the plugin settings page.