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

Possible to give permissions per property? #69

Open
adamski opened this issue Sep 27, 2014 · 4 comments
Open

Possible to give permissions per property? #69

adamski opened this issue Sep 27, 2014 · 4 comments

Comments

@adamski
Copy link

adamski commented Sep 27, 2014

Would it be possible to give a permission, not just per resource but also per property? I.e. so a user can be limited to only seeing certain properties of a given resource, or only able to edit certain properties and view others.

Happy to fork and implement myself just would like to see how feasible it would be. Thanks.

@mainul098
Copy link

I also want to use this kind of feature but unfortunately don't find it in the current implementation. This would be a great feature if it can be implemented. Is there any way to implement this?

@fyockm
Copy link
Contributor

fyockm commented Sep 28, 2014

I also have a need to restrict certain fields to be edited only by particular roles. Is there another module that could be used in conjunction with this to achieve that requirement? Or is it easier to modify this?

@manast
Copy link
Member

manast commented Sep 29, 2014

Without having giving a lot of thought to this all I can say is that in the way ACL is designed it really doesn't care about javascript objects, so implementing something like this may not be possible...

@smilledge
Copy link

Maybe this could be done by adding the field to the permission, something like:

// "bob" is an editor and "joe" is the author
acl.addUserRoles('bob', 'editor');
acl.addUserRoles('joe', 'author');

// Editor has edit permission on all fields
acl.allow('editor', 'articles', ['edit:*']);

// Authors can only edit the article title, body and tags
acl.allow('author', 'articles', ['edit:title', 'edit:body', 'edit:tags']);

This would require changing the way permission wildcards work so that the following would work as expected.

acl.isAllowed('joe', 'articles', 'edit'); // true
acl.isAllowed('joe', 'articles', 'edit:published'); // true
acl.isAllowed('bob', 'articles', 'edit:published'); // false
acl.isAllowed('bob', 'articles', 'edit'); // ?

I have not tried this so it might not work too well in practice, just a thought.

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

5 participants