Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should the Manager class handle multiple drivers? #3

Closed
driesvints opened this issue Nov 17, 2014 · 5 comments
Closed

Should the Manager class handle multiple drivers? #3

driesvints opened this issue Nov 17, 2014 · 5 comments

Comments

@driesvints
Copy link
Contributor

Currently the Manager class accepts a single driver to store all permissions. I was thinking about allowing multiple drivers to be set. So some can be ready only with the storePermission and deletePermission methods not do anything on a read-only driver. But then you can do things like:

$manager->driver('production')->caller($caller)->can(...)
$manager->driver('local')->caller($user)->can(...)

This makes it easy to determine permissions locally for production settings.

Would this be a nice to have?

@driesvints driesvints added this to the 1.0 milestone Nov 17, 2014
@driesvints driesvints mentioned this issue Nov 17, 2014
Closed
22 tasks
@franzliedke
Copy link

I don't need it. Is there an exact use case?

@driesvints
Copy link
Contributor Author

I don't need it. Is there an exact use case?

A use case could be local development. Where you'd easily could use the production driver with a DB implementation to your production DB to check permissions for your production environment but with a read only driver so you'd never edit your production settings. This is of course mostly for persistent drivers. Doesn't really makes sense for static drivers.

I have to admit. This idea sounds far fetched with only a few use cases so I'm going to move this from the 1.0 milestone to a concept label and implement it in a future release if people ever need it.

@driesvints driesvints removed this from the 1.0 milestone Nov 27, 2014
@driesvints
Copy link
Contributor Author

I think I found a valid use case. There could be some situations where you need both persistent and static drivers. I've found out in a large app that I'm maintaining I'm using both a persistent driver for user permissions on organizations and a static driver for the organization types. Will dig into this later to see if I can come up with something useful.

@sagikazarmark
Copy link

Hey, just found this package. Coming from sentry (crying for sentinel being open source) this one is the heaven itself.

To respond to this one as well: I think this belongs to a dependency container. Even when using multiple instances.

@driesvints
Copy link
Contributor Author

@sagikazarmark Hey there! First of all, thanks for the nice words! :)

You're probably right about that. I guess the developer can always choose to bind as many Manager instances as he likes into some sort of container. Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants