mirror of
https://github.com/ansible/awx.git
synced 2026-06-24 16:17:51 -02:30
AAP-48392 Handle DAB RBAC either before or after new type model (for merge) (#16045)
* Handle DAB RBAC either before or after new type model * Translate CT to DAB CT * Fixes for content type switch * Use more compatible coding pattern * Deeper purge of content_type_id * revert, turns out that did not work * More content type replacements * Revert changes to serializer * Revert another content_type change * Fix for rearrangement of post_migration methods * Remove thing I am not going to do * Revert branch pin that was temporary
This commit is contained in:
@@ -27,6 +27,7 @@ from django.conf import settings
|
||||
|
||||
# Ansible_base app
|
||||
from ansible_base.rbac.models import RoleDefinition, RoleUserAssignment, RoleTeamAssignment
|
||||
from ansible_base.rbac import permission_registry
|
||||
from ansible_base.lib.utils.models import get_type_for_model
|
||||
|
||||
# AWX
|
||||
@@ -561,7 +562,7 @@ def get_role_definition(role):
|
||||
model_print = type(obj).__name__
|
||||
perm_list = get_role_codenames(role)
|
||||
defaults = {
|
||||
'content_type_id': role.content_type_id,
|
||||
'content_type': permission_registry.content_type_model.objects.get_by_natural_key(role.content_type.app_label, role.content_type.model),
|
||||
'description': f'Has {action_name.title()} permission to {model_print} for backwards API compatibility',
|
||||
}
|
||||
# use Controller-specific role definitions for Team/Organization and member/admin
|
||||
|
||||
Reference in New Issue
Block a user