-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat: use Laravel's built-in Manager class #72
Conversation
@leeqvip plz review |
src/Loaders/LoaderManager.php
Outdated
* | ||
* To utilize a built-in or custom loader, set 'model.config_type' in the configuration to match one of the above types. | ||
*/ | ||
class LoaderManager extends Manager |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename it to ModelLoaderManager
src/LauthzServiceProvider.php
Outdated
$this->registerGates(); | ||
} | ||
|
||
/** | ||
* Register a gate that allows users to use Laravel's built-in Gate to call Enforcer. | ||
* | ||
* @return void | ||
*/ | ||
protected function registerGates() | ||
{ | ||
Gate::define('enforcer', function ($user, ...$args) { | ||
$identifier = $user->getAuthIdentifier(); | ||
if (method_exists($user, 'getAuthzIdentifier')) { | ||
$identifier = $user->getAuthzIdentifier(); | ||
} | ||
$identifier = strval($identifier); | ||
|
||
return Enforcer::enforce($identifier, ...$args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please submit another PR.
320a77c
to
62f8de5
Compare
- Use Laravel's built-in abstract Manager class instead of ModelLoaderFactory (php-casbin#71)
62f8de5
to
fe5839f
Compare
🎉 This issue has been resolved in version 3.4.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
feat: use Laravel's built-in Manager class