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

Unable to combine rules #260

Closed
HMilbradt opened this issue Feb 2, 2022 · 3 comments
Closed

Unable to combine rules #260

HMilbradt opened this issue Feb 2, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@HMilbradt
Copy link

ConditionsProxy.get currently combins all the conditions into a single object. This prevents you from declaring rules like the following.

Ex: Anyone can access public uploads, and users can access their own uploads

everyone({ can }) {
  can(Actions.read, Upload, { public: true });
},

user({ can, cannot, user }) {
  can(Actions.read, Upload, { user: user.id, public: false });
},

Calling conditions.get() produces the following object:

{ user: '4663a9ea-627c-483e-8e28-88739ffa0dc0', public: true }

Is there a possible way to work around this?

The problematic code can be found here:

return Object.assign({}, ...this.conditions);

Thanks!

@liquidautumn liquidautumn added the bug Something isn't working label Feb 3, 2022
@liquidautumn liquidautumn self-assigned this Feb 3, 2022
@liquidautumn
Copy link
Collaborator

Looks like a bug, I'll check asap.

@bouceka
Copy link

bouceka commented Jun 19, 2022

Any progress? I've been waiting for this fix.

@liquidautumn
Copy link
Collaborator

Fixed in v1.6.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants