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

feat: use Laravel's built-in Manager class #72

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

Dobmod
Copy link
Member

@Dobmod Dobmod commented Jul 1, 2024

feat: use Laravel's built-in Manager class

@hsluoyz
Copy link
Member

hsluoyz commented Jul 3, 2024

@leeqvip plz review

src/Loaders/LoaderManager.php Outdated Show resolved Hide resolved
*
* 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
Copy link
Member

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/EnforcerManager.php Show resolved Hide resolved
Comment on lines 61 to 78
$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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please submit another PR.

@Dobmod Dobmod force-pushed the feature-more-built-in-0.1 branch from 320a77c to 62f8de5 Compare July 5, 2024 08:21
- Use Laravel's built-in abstract Manager class instead of ModelLoaderFactory (php-casbin#71)
@Dobmod Dobmod force-pushed the feature-more-built-in-0.1 branch from 62f8de5 to fe5839f Compare July 5, 2024 08:26
@Dobmod Dobmod changed the title feat: use Laravel's built-in Manager class and integrate authorizatio… feat: use Laravel's built-in Manager class Jul 5, 2024
@leeqvip leeqvip merged commit 4d49aef into php-casbin:master Jul 5, 2024
49 checks passed
@leeqvip
Copy link
Member

leeqvip commented Jul 5, 2024

🎉 This issue has been resolved in version 3.4.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants