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

Permission for everything apart from self #66

Open
tomislav12 opened this issue Feb 25, 2019 · 1 comment
Open

Permission for everything apart from self #66

tomislav12 opened this issue Feb 25, 2019 · 1 comment
Labels
feature request Considered to be implemented.

Comments

@tomislav12
Copy link

Is there an option to set-up accesscontrol that some group of users, lets say Moderators,
can only create resource for everybody else, but not for themselves? Currently I did it like this:
{ role: 'moderator', resource: 'thing', action: 'create:any', attributes: 'createAnyButNotOwn' },
and then when checking for own:

let permission = null;
if (owned) {
 permission = ac.can( user.role ... etc );
 if (permission.attributes.indexOf('createAnyButNotOwn') > -1) {
            permission = false;
          }
}

Is there a better way? Thanks

@iolivia
Copy link

iolivia commented Apr 1, 2019

@onury is this supported currently by the library? looks like this is a nice workaround though 😄

@onury onury added the feature request Considered to be implemented. label Jan 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Considered to be implemented.
Projects
None yet
Development

No branches or pull requests

3 participants