snapshot: preserve role management and user lifecycle controls
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from workflows.roles import ROLE_STAFF, ROLE_SUPER_ADMIN, assign_user_role, ensure_role_groups
|
||||
|
||||
DEFAULT_USERS = [
|
||||
{
|
||||
@@ -43,6 +44,8 @@ class Command(BaseCommand):
|
||||
is_staff=item['is_staff'],
|
||||
is_superuser=item['is_superuser'],
|
||||
)
|
||||
ensure_role_groups()
|
||||
assign_user_role(user, ROLE_SUPER_ADMIN if item['username'] == 'admin_test' else ROLE_STAFF)
|
||||
self.stdout.write(f'created {user.username}')
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('initial users created'))
|
||||
|
||||
Reference in New Issue
Block a user