1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

Improved code clarity and UI naming for user owner role creation

#1499
This commit is contained in:
Akita Noek 2016-04-12 16:11:45 -04:00
parent c984b33f1e
commit a0356afbac

View File

@ -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)