开发者

Dynamic forum permissions in Drupal

开发者 https://www.devze.com 2023-01-20 03:16 出处:网络
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.

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 pr开发者_如何学Cogrammatically)


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号