chaps-io / access-granted

Multi-role and whitelist based authorization gem for Rails (and not only Rails!)
MIT License
774 stars 41 forks source link

Allow subclasses to match on superclass subject #56

Open jrochkind opened 1 year ago

jrochkind commented 1 year ago

if Bicycle < Vehicle, and you have a policy can :read, Vehicle, then already can?(:read, Vehicle.new) and can?(:read, Bicycle.new) are both true.

can?(:read, Vehicle) is also true.

I believe can?(:read, Bicycle) should also be true, it should respect the subclass. Bicycle is a kind of Vehicle, so if they have been granted permission to read all Vehicles, that applies to all Bicycles too.

Closes #55, see more there.

pokonski commented 1 year ago

Thank you for this, definitely an oversight!