-
Notifications
You must be signed in to change notification settings - Fork 144
feat: Add user relations loading methods for groups and permissions #1257
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: Add user relations loading methods for groups and permissions #1257
Conversation
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.
LGTM! Thanks.
@dgvirtual Please confirm if the issue has been resolved.
665af54 to
5272cc2
Compare
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.
LGTM! Thanks.
|
Thanks @datamweb |
|
I added in Bonfire2 src\Users\Controllers\UserController: The withGroups part works (-14 database calls). The withPermissions part seems to not work: I still get lazy loading on calling |
|
I guess this may occur when no permissions are set for the user. I will look into it tonight. |
|
Yep, could be, I will check that as well
…On Sun, 5 Oct 2025, 17:01 Michal Sniatala, ***@***.***> wrote:
*michalsn* left a comment (codeigniter4/shield#1257)
<#1257 (comment)>
I guess this may occur when no permissions are set for the user. I will
look into it tonight.
—
Reply to this email directly, view it on GitHub
<#1257 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAULV6QI6VYWRDV65KFEB333WEQCPAVCNFSM6AAAAABYBVKXG2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGNRZGA3TQOBSGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
@dgvirtual Please check #1290 when you get a chance. |
Description
This PR enhances user queries by enabling the retrieval of related user data more efficiently.
It adds two new methods:
withGroups()andwithPermissions(), which loads user groups and permissions directly when fetching users. The existingwithIdentities()method (previously undocumented) has also been included in the documentation.With these methods, all necessary user information can be loaded in a single query (one per used method), reducing the number of additional queries and improving performance.
The problem this PR solves was described in the Bonfire2 repo: lonnieezell/Bonfire2#558
Checklist: