-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Description
When calling grant! and revoke! on a policy the return value is always nil. A common paradigm when using accessly might be to grant a permission, and then do one thing if that grant was newly successful and another if it was not.
Since these are "command" methods, I would not advocate that they should return a value that indicates this (such as true or false), but potentially it returns "self" and there is a "query" type method we can then call on the policy to find out if the most recent grant attempt was successful? Then you could write code like:
policy = MyPolicy.new(actor)
policy.grant!(:some_permission)
if policy.permissions_changed?
do_a_thing
else
do_another
endThere could be the above method for generic "something has changed" status, and maybe there could also be more specific way to retrieve what changed like:
policy = MyPolicy.new(actor)
policy.grant!(:some_permission)
if policy.permissions_changed.include(:some_permission)
do_a_thing
else
do_another
endMetadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request