Limiting Access to a set of users

Limiting Access to a set of users

by Niaj Garg -
Number of replies: 8
Dear Friends,

I am using Moodle 1.9.5+ (Build: 20090708). I am using both LDAP and database based users.

Issue: There are two sets of Users :

Set A : Users who should have a default student role and should be able to access all courses. About 500 users accessing round the year.

Set B : Users who should be able to access only the courses in which they are given specific access. About 65 users need to made them active only for 3 months in a year.

Any idea how this could be made possible. ( PS I do not want to use enrollment key, since i have to then give key to a large number of users)

Thanks a lot for your support.
regards
niraj
Average of ratings: -
In reply to Niaj Garg

Re: Limiting Access to a set of users

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
How are you creating user accounts on the site? How do you differentiate between the two groups of users?
In reply to Howard Miller

Re: Limiting Access to a set of users

by Niaj Garg -
I am using LDAP for first set of users and database for second set of users. However I think the way users are created should not have any impact on these..
regards
niraj
In reply to Niaj Garg

Re: Limiting Access to a set of users

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
However I think the way users are created should not have any impact on these..

Oh well... if you already know how to do it... wink

If you don't first have a way to differentiate between these users then how can it work at all? Have a look at LDAP and database enrollment. Set up LDAP enrollment so that is just lets everybody into everything. Set up database enrollment so that it just lets users into the restricted courses.

It's not quite that simple - you'll probably need to create some additional LDAP field(s) and an enrollment database table but I think that's the way to go. It might even be easier to make a minor hack to the enrollment code.

In reply to Howard Miller

Re: Limiting Access to a set of users

by Niaj Garg -
"Set up database enrollment so that it just lets users into the restricted courses."
That true... This is what I wish to Do. I tried as follows:

1. Removed general (student ) role to these (Set B) uses and give them only site wide guest role.
2. Given these setB role of Students in the course in which I wish to give them acess.
3. The front page default role is autenticated users.

The problem with this approach is ... the moment a user logs in the front page is blank.

if I use http://mymoodledomain/my the following message is displayed..

"The 'Course Overview' page is not available to guest users

Would you like to log in now with a full user account?"...


How do I take care of this situation....


thanks in advance for all your support.


regards

niraj

In reply to Niaj Garg

Re: Limiting Access to a set of users

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
It's nothing to do with roles!

You want (presumably) both sets of students to have the same rights within the courses they are enrolled in so you can't do this by creating roles.

All you need to do is to fool database enrollment into adding all the restricted users into all the restricted courses. You just need to create a table that has an entry for every user and every restricted course. Shouldn't be hard! A cron script could create that nightly - presumably there's some way of identifying the offending courses.
In reply to Howard Miller

Re: Limiting Access to a set of users

by Niaj Garg -
I have manually added all students of Set B in a course. The issue left is....

1. IF I login as a member of set A, everything working as required.
2. IF I login as member of Set B.. the problems are ..

a. nothing is visible on Front Page ..

b. If I go to http://mymoodledomain/my.. it gives error as described above.


c If i try to access the course directly by typing http://my moodledomain/course/view.php?id='courseid' after logging in.. the error message is ..

Sorry 'course name' ..
does not allow guests to enter. I believe even if I have given the role of student for the course the same is not being made effective at the course level and the member of set B continue to have a role of "guest" as defined at a system level.

This definitions of "guest" role at the system level level should have been overridden by "student" role define at the course level. which is not happening.. Or an I wrong in interpretation...

How do I resolve this..

Thanks in advance..

regards
niraj


In reply to Niaj Garg

Re: Limiting Access to a set of users

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Yep - I read that the first time wink Doesn't change my answer.

What do you mean by 'nothing visible'? Do you mean a blank page?
In reply to Howard Miller

Re: Limiting Access to a set of users

by Niaj Garg -
Thanks a lot for your help. By nothing visible I meant that no course is visible on the first page. I could solve the problem by changing the role allocation.

for the Set B which requires only restricted access: I removed the role override to guest only in the course, in which I do not want them access. This has solved by problem. However, I still have to remove access for every course.

thanks a lot for your support.
with regards
niraj