mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 07:17:40 -02:30
Make use of 'current' apps so RBAC ImplicitRoleField can work during migrations
While a migration is taking place, we can't juse use normal model references like Role and RolePermission, nor can we use generic foreign keys without manually referring to the content type and object id fields.
This commit is contained in:
@@ -5,7 +5,7 @@ from django.db.models import Q
|
||||
from django.utils.timezone import now
|
||||
|
||||
from collections import defaultdict
|
||||
from awx.main.utils import getattrd
|
||||
from awx.main.utils import getattrd, set_current_apps
|
||||
|
||||
import _old_access as old_access
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -26,6 +26,10 @@ def log_migration(wrapped):
|
||||
return wrapped(*args, **kwargs)
|
||||
return wrapper
|
||||
|
||||
@log_migration
|
||||
def init_rbac_migration(apps, schema_editor):
|
||||
set_current_apps(apps)
|
||||
|
||||
@log_migration
|
||||
def migrate_users(apps, schema_editor):
|
||||
User = apps.get_model('auth', "User")
|
||||
|
||||
Reference in New Issue
Block a user