cancancan icon indicating copy to clipboard operation
cancancan copied to clipboard

Allow can with query on single resource

Open kaspernj opened this issue 2 years ago • 2 comments

Passing a query to a rule is already supported by accessible_by but not when checking on a single resource. This PR fixes that and adds specs for it.

Example usage:

can :read, ProjectPart, state: "won", offer_won: {account_id: current_accounts.select(:id)}

kaspernj avatar May 03 '22 13:05 kaspernj

Did anyone have time to take a look at this? :-)

kaspernj avatar May 13 '22 19:05 kaspernj

I just posted an issue related to this (but a bit more general maybe?): https://github.com/CanCanCommunity/cancancan/issues/812

And a PR with a proposed change: https://github.com/CanCanCommunity/cancancan/pull/813

Open for feedback.

oboxodo avatar Jan 23 '23 01:01 oboxodo