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

Implement $lock->clear() method? #6

Closed
driesvints opened this issue Nov 21, 2014 · 6 comments
Closed

Implement $lock->clear() method? #6

driesvints opened this issue Nov 21, 2014 · 6 comments
Labels

Comments

@driesvints
Copy link
Contributor

Would it make sense to implement a clear method for a lock instance to clear any matching permissions, either privileges or restrictions? This could be an easy way to clear permissions to get a fresh start. But I'm not sure if it would be very useful for many people.

The api would be:

public function clear(
    string|array $action,
    string|\BeatSwitch\Lock\Contracts\Resource $resource = null,
    int $resourceId = null
)

Thoughts?

@driesvints driesvints added this to the 1.0 milestone Nov 21, 2014
@driesvints driesvints mentioned this issue Nov 21, 2014
Closed
22 tasks
@driesvints
Copy link
Contributor Author

Perhaps for a future release. Gonna leave this open for now.

@driesvints driesvints removed this from the 1.0 milestone Dec 4, 2014
@cegrif01
Copy link

I can see that being pretty useful. During testing, I find myself having to run a migrate:refresh --seed to get a blank slate, so I can see exactly what changed when I set permissions.

@driesvints
Copy link
Contributor Author

@cegrif01 that's something I'd recommend doing every time anyway in your PHPUnit setUp method. Remember that Laravel has a neat helper method for that $this->seed(). Check http://laravel.com/docs/4.2/testing#helper-methods

I think the clear method would be appropriate if you would clear all the permissions for a certain caller or role or for the specified parameters.

@simsim2006
Copy link

+1

This make really sense ! In my case, I would like to be able to remove explicit permission (deny/allow) of a caller and let the roles (inherited by him) determine if he can perform an action on a resource

@driesvints
Copy link
Contributor Author

This has now been added in #41. Docs update and new release coming soon.

@driesvints
Copy link
Contributor Author

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

No branches or pull requests

3 participants