mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 11:41:08 -03:30
@@ -5,6 +5,7 @@
|
|||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import re
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
from django.db import models, transaction, connection
|
from django.db import models, transaction, connection
|
||||||
@@ -47,18 +48,18 @@ role_names = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
role_descriptions = {
|
role_descriptions = {
|
||||||
'system_administrator' : '[TODO] System Administrator',
|
'system_administrator' : 'Can manage all aspects of the system',
|
||||||
'system_auditor' : '[TODO] System Auditor',
|
'system_auditor' : 'Can view all settings on the system',
|
||||||
'adhoc_role' : '[TODO] Ad Hoc',
|
'adhoc_role' : 'May run ad hoc commands on an inventory or a group',
|
||||||
'admin_role' : '[TODO] Admin',
|
'admin_role' : 'Can manage all aspects of the %s',
|
||||||
'auditor_role' : '[TODO] Auditor',
|
'auditor_role' : 'Can view all settings for the %s',
|
||||||
'execute_role' : '[TODO] Execute',
|
'execute_role' : 'May run the job template',
|
||||||
'member_role' : '[TODO] Member',
|
'member_role' : 'User is a member of the %s',
|
||||||
'owner_role' : '[TODO] Owner',
|
'owner_role' : 'Owns and can manage all aspects of this %s',
|
||||||
'read_role' : '[TODO] Read',
|
'read_role' : 'May view settings for the %s',
|
||||||
'scm_update_role' : '[TODO] SCM Update',
|
'scm_update_role' : 'May update the project from the configured source control management system',
|
||||||
'update_role' : '[TODO] Update',
|
'update_role' : 'May update the inventory or group using the cloud source update system',
|
||||||
'use_role' : '[TODO] Use',
|
'use_role' : 'Can use the %s in a job template',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -152,7 +153,13 @@ class Role(models.Model):
|
|||||||
@property
|
@property
|
||||||
def description(self):
|
def description(self):
|
||||||
global role_descriptions
|
global role_descriptions
|
||||||
return role_descriptions[self.role_field]
|
description = role_descriptions[self.role_field]
|
||||||
|
if '%s' in description and self.content_type:
|
||||||
|
model = self.content_type.model_class()
|
||||||
|
model_name = re.sub(r'([a-z])([A-Z])', r'\1 \2', model.__name__).lower()
|
||||||
|
description = description % model_name
|
||||||
|
|
||||||
|
return description
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def rebuild_role_ancestor_list(additions, removals):
|
def rebuild_role_ancestor_list(additions, removals):
|
||||||
|
|||||||
Reference in New Issue
Block a user