-
Notifications
You must be signed in to change notification settings - Fork 0
Tests etc #2
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
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # src/Repository/RoleRepository.php
|
|
||
| try { | ||
| return $this->rbacManager->hasPermission($attribute, $user->getId()); | ||
| return $this->rbacManager->hasPermission($attribute, $user->getUserIdentifier()); |
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.
I think this could break things because subsequent queries rely on the user id, not the public-facing user identifier (email, username, etc). It uses the id for subsequent authorization queries.
But as you know, there is no UserInterface::id:
https://github.com/symfony/symfony/blob/7.1/src/Symfony/Component/Security/Core/User/UserInterface.php
For me, static analysis has highlighted that this bundle is designed to the wrong interface (UserInterface instead of User). I think that the fix here would be to depend on User.
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.
We could also keep it the way it is, but change the SQL queries
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.
yea I think the issue is that the User entity comes from the config and we're not sure that id will exist either.
in our case, I think userIdentifier works better?
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.
userIdentifier works, I think we'd just need to update Rbac::hasPermission() to transform the userIdentifier string into an int for subsequent queries. We could also modify PermissionRepository::hasPermission(). Downside is more lookups/joins as opposed to original implementation that relies only on ids.
No description provided.