2

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)

Kay Pale
  • 6,449
  • 7
  • 28
  • 28

3 Answers3

1

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
  • 10,163
  • 2
  • 29
  • 30
0

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
  • 2,077
  • 2
  • 25
  • 36
  • 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 Oct 15 '10 at 08:03
  • Anything that is done through the GUI can be done programatically. Just takes some digging into the Forum Access API to figure it out – Erik Ahlswede Feb 17 '11 at 05:09
0

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,900
  • 15
  • 21