views:

48

answers:

3

My users access Drupal through SSO and everytime the server authorizes them, it returns a set of permissions (groups/roles), according to which I need to dynamically set the User's forum permissions.

So for example if a User logs in and the SSO says that he has enrolled in a course, I need to give him specific permissions for that course's forum.

Obviously I need a custom module for that, but it's a little hard to start.

I'm thinking of using the ACL module's API, but I can find any documentation or tutorial online. Is there any?

Is there a better way to get around this?

I'd appreciate any help :)


(note: I know there are modules with GUI that have similar functionality but I need to do it programmatically)

A: 

Check out Forum Access. It can restrict users based on their roles.

You could have your roles be something like "CSC221 Student". If a user has this role, they will be able to access the CSC221 forum.

Erik Ahlswede
Hi Erik, you probably missed the last line of my question: "I know there are modules with GUI that have similar functionality but I need to do it programmatically".
Kay Pale
A: 

Create a hook_user function ( see http://api.drupal.org/api/function/hook_user ) in your module.

Then using http://drupal.org/project/permissions_api set the appropriate permissions on the user.

troynt
+1  A: 

We just put something exactly like this into place - we used the Rules module (with the User logged in trigger), checking the LDAP groups that the user is enrolled in, and assigned the role accordingly.

Andrew Sledge