Created
November 11, 2024 10:45
-
-
Save nyrahul/a1a8d731179bf34b8209b9e7a1fdbc2f to your computer and use it in GitHub Desktop.
Fix permissions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl exec -it -n accuknox-divy deployments/uwsgi -- python3 manage.py shell -c "from source.models.roles import Role | |
from tenant.models import Permission,Client, VisiblePermissions | |
from django_tenants.utils import schema_context | |
for client in Client.objects.exclude(schema_name__in=['root']): | |
with schema_context(client.schema_name): | |
print(client.schema_name) | |
admin_role = Role.objects.get(name='Admin') | |
for permission in Permission.objects.all(): | |
admin_role.permissions.add(permission) | |
for vp in VisiblePermissions.objects.all(): | |
admin_role.visible_permissions.add(vp) | |
admin_role.save()" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment