Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign user role based on group membership #125

Open
nyulawbrian opened this issue Feb 11, 2023 · 1 comment
Open

Assign user role based on group membership #125

nyulawbrian opened this issue Feb 11, 2023 · 1 comment

Comments

@nyulawbrian
Copy link

In the LDAP configuration, it is possible to use multiple LDAP search bases, however all users are assigned the same role. This feature would allow mapping a role assignment to each search base (or group membership, depending on the external auth service selected). Upon each login, the role would be updated to either the least-privileged or most-privileged role (based on a configurable option), if and when the user is added or moved to a different search base (or group) than when originally created. This would require checking all search bases on each login.

Thanks so much!

@figureone
Copy link
Member

This seems reasonable and we do have an issue set up to track creating a UI for custom role mappings, but so far little time to dedicate to it:
#75

That said, it is possible to do this right now via the authorizer_custom_role filter:
https://github.com/uhm-coe/authorizer/blob/master/readme.txt#L501-L518

I would suggest checking $user_data['ldap_attributes'][0]['dn'] to get the DN of the logging in user which should be of the form uid=username,ou=group,dc=example,dc=edu so the search base should be contained in there. Then you can return a different role name based on which base it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants