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

Add group support for authorization #37

Open
mikesparr opened this issue Feb 6, 2019 · 3 comments
Open

Add group support for authorization #37

mikesparr opened this issue Feb 6, 2019 · 3 comments
Assignees

Comments

@mikesparr
Copy link
Owner

Often a user is a member of one or more groups, and may have permissions specific to that group that differs from others, or access to resources owned by that group. We should add support for groups and authorization based on group membership.

@mikesparr mikesparr self-assigned this Feb 6, 2019
@barbarosso
Copy link

Hi mikesparr,
Do you have any ideas how to implement this?

I would like to help on this feature, and would like to create a pull request, but i'm not sure how to implement this.

Regards
Pascal

@mikesparr
Copy link
Owner Author

It's been a few months since I was working on this. There are a couple ways to do it, either leveraging the graph (bi-directional node / relation table) and adding user associations MEMBER_OF to a Group node. Then when performing the authorization check, fetch all the associations of the user of desired otype (object type), and if the resource is also member of that, then determine if isOwnerOrMember should be true.

Another way to do it is using the relational DB and add a Group entity with relations to User and similar check when authorizing the actions. I haven't decided yet which direction I wanted to take but all the pieces are in place to implement either. The key is in your DAO when you're authorizing the method, you perform a query at the top to check if they are member of the group the resource is linked to, and then set the isOwnerOrMember accordingly.

If I find time this Summer I'll revisit and implement but this was meant as a starter that anyone could then extend to their liking/needs. Hopefully those ideas help you with your project. ;-)

@barbarosso
Copy link

Hi @mikesparr ,
I'll go for the second option, the graph way is still a bit fuzzy for me.

thx

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

No branches or pull requests

2 participants