mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 15:21:13 +03:00
parent
c984b33f1e
commit
a0356afbac
@ -123,10 +123,14 @@ def sync_superuser_status_to_rbac(instance, **kwargs):
|
||||
|
||||
def create_user_role(instance, **kwargs):
|
||||
try:
|
||||
instance.admin_role
|
||||
Role.objects.get(
|
||||
content_type=ContentType.objects.get_for_model(instance),
|
||||
object_id=instance.id,
|
||||
name = 'Owner'
|
||||
)
|
||||
except Role.DoesNotExist:
|
||||
role = Role.objects.create(
|
||||
name = '%s-admin_role' % instance.username,
|
||||
name = 'Owner',
|
||||
content_object = instance,
|
||||
)
|
||||
role.members.add(instance)
|
||||
|
Loading…
Reference in New Issue
Block a user