laravel-starter-kit icon indicating copy to clipboard operation
laravel-starter-kit copied to clipboard

Suggetions: Using spatie laravel-permission instead of a custom build

Open twf-nikhila opened this issue 5 years ago • 4 comments

Firstly, thanks for this awesome starter kit.

I think it will be really nice if instead of having a custom developed permission/group management spatie:laravel-permission package is used. https://github.com/spatie/laravel-permission

Advantages

  • Better support for permission management
  • Easy to use as compared to the one used here.
  • Detailed documentation
  • Flexibility (like configurable table names for permission, roles etc)
  • Support for the cache which makes permission validation faster instead of querying for each permission.

Many developers are already familiar with this package, so adding I think adding it will certainly make this better.

Looking forward to hearing all of your opinions.

twf-nikhila avatar Feb 12 '19 11:02 twf-nikhila

Thank you for your input. I know spatie library since it was still young but it was lacking some complex permission handling before versus the laravel sentry which this custom build was inspired from. But I can see the spatie has grown already and for sure it has already those complex permission that was missing before.

When I say complex permission handling, here is an example:

We give permission to be able to "add" and "delete" for GROUP A. Then we assign user 1 to GROUP A. So User 1 will have those permissions. Then now we have user 2 added to GROUP A as well, but we don't want user 2 to be able to "delete", so we assign a special permission to user 2 to deny him for delete permission.

This scenario was not supported in spatie way back year ago when it was young. but laravel sentry has this but sentry was not free. So I created my own custom built with the sentry capabilities.

To be honest, I don't have plans implementing a 3rd party permission handling since the goal for this is to be stand alone much as possible. And transitioning to using spatie will be a bit of work and I have a very hectic schedule at the moment. But I will consider looking into spatie again when I have the time.

Happy coding!

darryldecode avatar Feb 12 '19 15:02 darryldecode

Thank you for the detailed response. Definitely transition to spatie Laravel permission will take time & effort, but will be worth it. I can send a PR if you want this to be included. Let me know.

Thank you

twf-nikhila avatar Feb 12 '19 16:02 twf-nikhila

Hi @twf-nikhila , if you can do that w/o affecting much on how UX is presented with managing user, groups & permissions, that would be great! We will have two branches then, 1 for the spatie version. Thanks!

darryldecode avatar Feb 12 '19 23:02 darryldecode

am actually interested in this, would love to help out with migration if anyone has started working on it

sparkEEdev avatar Aug 05 '19 09:08 sparkEEdev