-
Notifications
You must be signed in to change notification settings - Fork 50
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
So many queries?! #26
Comments
I figured out why there are so many queries...
If a user has 40+ permissions, this is hitting the database 40+ times. Perhaps a more efficient route would be to make use of Adonis.pivotTable()? |
you can check my fork where I did some optimizations to how the plugin query permissions and roles i've changed it so that instead of it querying data everytime you use the middleware or use the can/is methods inside a controller, it will now use the prefetched permissions and roles already populated from the main "init" middleware. |
Nice job! Althought a great package, it definitely needed some
optimization. If I get some free time, I'll allow the package to cache
permissions/roles to limit hits on the db. Thanks for this!
…On Wed, Dec 26, 2018 at 1:36 PM Abdulhadi Hallak ***@***.***> wrote:
you can check my fork where I did some optimizations to how the plugin
query permissions and roles
https://github.com/hadihallak/adonis-acl
i've changed it so that instead of it querying data everytime you use the
middleware or use the can/is methods inside a controller, it will now use
the prefetched permissions and roles already populated from the main "init"
middleware.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#26 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AO9K-KGJ3m8kRpACde49mYcgG6i8hIX9ks5u88GTgaJpZM4Y0dVe>
.
|
@twigs67 I would just do something like this:
Does that work for your use case? |
@jacobwise I do not know if this works for @twigs67, but for me it took a user and needed to load their documents with their permissions this works, thanks |
@hadihallak can you send a PR with your improvements? |
Does no any fix from 2018 in this repo? |
Project is apparently abandoned. |
Hello,
I'm not sure if I'm doing something wrong or this is by design, but when the application initially loads the system is making over 70+ queries on permissions/permission_role/role tables.
Thanks
The text was updated successfully, but these errors were encountered: