How do I prevent some users from enrolling themselves in some courses?

How do I prevent some users from enrolling themselves in some courses?

by Ted Osborne -
Number of replies: 6

I have a Moodle 2.6 site we're using in my company with a hundred or so courses and maybe a dozen categories. Users (employees) authenticate via LDAP and single sign-on (NTLM SSO) against our Active Directory server. There are currently about a thousand users. Once logged in, they're free to self-enroll in any course they like.

Now I'm trying to grant access to the site to a few non-employees (contractors). They will log in manually (they're not defined in our Active Directory system-I will configure logins for them). But I want to restrict their access to only one or two courses (or maybe only the courses in a single category). I want to prevent them from enrolling in any of the other courses on the site. (It would be even better if I could prevent them from even seeing those other course titles.)

I can't use enrollment keys because it imposes unfair friction to employees, who comprise the vast majority of users.

The conditional user fields feature looked promising, but it's too low-level (activity/resource/section). The I'd like to restrict access at the course/category level.

I'd like to avoid using anonymous "guest" access, because I'd like to offer forums/quizzes etc. to the contractors for the courses to which they have access.

Any ideas on the best way to configure contractor access to my site?

Thanks much,

Ted

Average of ratings: -
In reply to Ted Osborne

Re: How do I prevent some users from enrolling themselves in some courses?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I can't think of a way to do this.

There is a capability enrol/self:unenrolself which can be used to control the opposite thing, but to solve your problem we woudl need a enrol/self:enrolself capability. I wonder if it is worth creating a tracker issue to request that?

In reply to Tim Hunt

Re: How do I prevent some users from enrolling themselves in some courses?

by Ted Osborne -

Thanks Tim! I was looking for exactly a permission capability like you suggest.

I'll create a tracker issue - after a lot of forum searching, I think this problem comes up a lot. 

In reply to Ted Osborne

Re: How do I prevent some users from enrolling themselves in some courses?

by John Gifford -

Sounds to me like a cohorts setup...

Shouldn't be too much work, 2 cohorts and modifying the enrolment method for a hundred or so courses.

Essentially you get rid of the self-enrolment and setup cohorts of your regular users, 1 or more depending on how many different groups you want to consider e,g accounts staff can access this set of courses; warehouse staff another set etc. By the sound of it though you'd only need 1 for your regular users as they can access any course. Then you add another cohort for the external users.

With the cohorts established you use the cohort sync enrolment method and enroll the regular students into all courses while your externals can be enrolled onto selected courses. There wouldn't be any need for enrolment keys or the use of conditional access. With cohorts the user is effectively already enrolled on the course by way of their membership of the cohort, even though they haven't accessed it.

The external users would then not be able to access any course that didn't have their cohort as part of the enrolment scheme. You can even have multiple cohorts for the external users if you want a certain group of users to access a certain set of courses.

I hope this has been of some help but if you need any help please don't hesitate to let me know.

John Gifford

In reply to John Gifford

Re: How do I prevent some users from enrolling themselves in some courses?

by Ted Osborne -

Thanks John. I was looking at a cohort solution too, and I was specifically hoping to use the new-ish Allowing only cohort members to self-enroll feature. Here's my dilemma with cohorts:

  1. Assigning cohort membership manually is not scalable for us. New users log into the site via LDAP authentication and single sign-on (and thus Moodle logins get created) quite frequently (the company hires new employees weekly). It would be hard for me to monitor for new logins and assign them to the cohort. And our users wouldn't tolerate the wait. 

    I found an LDAP cohort sync plugin that looked interesting, but it's basically a script that relies on a cron job - so new users would have to wait for the cron job to trigger before they would become a member of the mapped cohort.

    And I just found another Autoenrol cohort plugin that claims to automatically assign users to cohorts based on user profile fields. I'll need to experiment with this one.

  2. I don't think cohort sync enrolment authentication would work for us, because we use enrollment to track course popularity/usage. If everyone is automatically enrolled in all/most courses, it's tough to gauge which courses students elected to participate in. [Question: Should I not be depending on enrollment as a measure of interest/activity?]
I'm grateful for any other ideas you may have, or corrections to my understanding.

Thanks much,

Ted
In reply to Ted Osborne

Re: How do I prevent some users from enrolling themselves in some courses?

by John Gifford -

I can see your problem it would be a task and a half to admin manually. I still think cohorts are going to be the basis of the solution though, however you actually implement it.

As to the tracking issue Moodle  has some participation reports, either in built or plugin, that will show how any course is being attended wouldn't that serve for your popularity/usage stats? A couple of the reports I've seen can literally track whether the student is active in the course, second by second; you can see if they're involved or just logged in and sitting on the course page. You can see what part they've taken in forums and chat sessions etc. I don't know if these would be of any use to you? I use a daily report myself to track user activity [logins, quiz participation, course activity etc.] it's non course specific but I can see for example that this Monday had X distinct user logins while last Monday had Y and then look at the reasons for the difference e.g. school holiday.

If that autoenrol cohort works on ldap/manual authentication as it's trigger that should solve your problem but from my brief reading of it, it seems to prefer profile fields that your users would then need to fill out.

As for the cron job do you know what sort of load it would put on your server if you ran it every 60 seconds or every 30 seconds? because then your users could be presented with a usage policy document after they login to their account the first time that takes say 30 seconds to read through...In that time the cron job runs and they get allocated to the correct cohort and will be unaware anything has happened. I've had staff members login to a course as a student, I've changed them to teacher status and they refresh the page (of course I have to know they've logged in as a student first). The job though depends on CPU load after all a job that's going to bring your Moodle to it's knees every time it runs is not practical is it? But I'd say unless you have huge numbers of simultaneous logins the cron job shouldn't be overpowering it will only be dealing with a small number of users at any one time, you run the initial job overnight so the users are all in their cohorts and then run the cron job for a week to determine average load then you start phasing out the self-enrolment.

If worst comes to worst I'm being made redundant at the end of August so got a job? wink

John Gifford