vintasoftware / django-role-permissions

A django app for role based permissions.
http://django-role-permissions.readthedocs.org/
MIT License
728 stars 114 forks source link

sync_roles --reset_user_permissions taking too much time #116

Closed shahzad-mycroft closed 4 years ago

shahzad-mycroft commented 4 years ago

Hi, I am using this package in my project based on DRF. There are multiple user roles and multiple permissions for each API endpoint.

I have about 15000 users in the database. When I run sync_roles --reset_user_permissions it's taking too much time, especially on the server. Is there any way to quickly run this?

UrK commented 4 years ago

IMHO, that's why the following appears in documentation: https://django-role-permissions.readthedocs.io/en/stable/admin.html:

WARNING: --reset_user_permissions is primarily intended for development, not production!

It loops over all the users in the database resetting their permissions. That's why it takes such a long time.

filipeximenes commented 4 years ago

Sorry for the delay folks. Yep @UrK is right, this is not production ready command. I'm closing this issue, fell free to reopen in case you think there's something we can do here. Stay safe :)