masonite icon indicating copy to clipboard operation
masonite copied to clipboard

Improving authorization policies registration

Open Marlysson opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. Instead of passing a list of tuples, with this change is passed a Policy instance with related model injected.

What do we currently have to do now? Change Policy signature

Describe the solution you'd like Passing the user into policy constructor

  • [x] Is this a breaking change?

Additional context Change signature of how register policies:

From

Gate.register_policies([(Model1, Policy1), (Model2, Policy)])

To:

Gate.register_policies(Policy1(Model1), Policy2(Model2))

Marlysson avatar Feb 14 '22 06:02 Marlysson

I will think about this 😉

girardinsamuel avatar Feb 14 '22 09:02 girardinsamuel