Zizaco / entrust

Role-based Permissions for Laravel 5
MIT License
6.05k stars 1.29k forks source link

Polymorphic permissions #4

Open atrauzzi opened 11 years ago

atrauzzi commented 11 years ago

Might be nice to be able to have permissions specified against multiple types of data.

Either by class (id column is null), or instance (id column is not null).

Also global permissions are possible by having both class and id as null.

See this rails package for an idea as to how useful it can be: http://eppo.github.com/rolify/

andrew13 commented 11 years ago

Very interesting idea and thanks for the link to the rolify. I'll review it and see what can be added without making it too complicated.

andrew13 commented 11 years ago

I took a longer look at the rolify, not quite sure what it provides without installing it and testing it.

andrew13 commented 11 years ago

I think I see what you mean. Be able to specify a role or permission against a specific class or object. I think thats a really neat idea, but I think it's beyond the scope of entrust at the moment.

nicodemuz commented 11 years ago

+1

This would be exactly what I need! :)

phazei commented 10 years ago

That would be great. Currently building a CMS that manages multiple sites. Users will have a edit permission but only for a particular site, or multiple sites for example. This feature would be really useful.

carcinocron commented 10 years ago

:+1:

dambridge commented 10 years ago

Not sure if I follow correctly, but would this satisfy a mult-tenant situation, ie, using 'tenant_id' column?

adanarchila commented 9 years ago

+1

deardooley commented 9 years ago

+1

deardooley commented 9 years ago

I had a pressing need for something like this, so I went ahead and implemented it. The pull requests is https://github.com/Zizaco/entrust/pull/245. You will need to migrate your pivot table if you are already running this on your site. If this gets merged, I will port it to L5 as well. As I'm not using L5 at the moment, that wasn't a top priority for me, but I'm happy to give back.

georgeboot commented 9 years ago

I really like this idea! I searched a lot for a perfect rbac library for Laravel that does support object based permissions, and this would be it.

For me I need specific roles per event. Organisers have their own events which they can edit, but moderators get assigned to certain events, on which they need to perform certain tasks. Having a way of combining permissions with objects would solve this matter completely.

ThemePlugger commented 9 years ago

+1