mirror of
https://github.com/ansible/awx.git
synced 2026-11-22 00:06:10 -03:30
intermediary state, not yet known to be working
This commit is contained in:
+6
-6
@@ -219,19 +219,19 @@ class BaseAccess(object):
|
||||
elif "features" not in validation_info:
|
||||
raise LicenseForbids("Features not found in active license.")
|
||||
|
||||
def get_user_capabilities(self, obj):
|
||||
def get_user_capabilities(self, obj, method_list=['edit', 'delete']):
|
||||
user_capabilities = {}
|
||||
|
||||
if hasattr(obj, 'get_can_edit'):
|
||||
user_capabilities['change'] = obj.get_can_edit(self.user)
|
||||
elif hasattr(obj, 'can_edit'):
|
||||
user_capabilities['change'] = obj.can_edit
|
||||
# if hasattr(obj, 'get_can_edit'):
|
||||
# user_capabilities['change'] = obj.get_can_edit(self.user)
|
||||
# elif hasattr(obj, 'can_edit'):
|
||||
# user_capabilities['change'] = obj.can_edit
|
||||
|
||||
if isinstance(obj, JobTemplate):
|
||||
user_capabilities['copy'] = self.user.can_access(type(obj), 'add', { 'reference_obj': obj })
|
||||
print(type(obj))
|
||||
|
||||
for method in ['change', 'delete', 'start']:
|
||||
for method in method_list:
|
||||
try:
|
||||
if isinstance(obj, Group) and method is 'start' and obj.inventory_source:
|
||||
obj = obj.inventory_source
|
||||
|
||||
@@ -105,9 +105,6 @@ class ProjectOptions(models.Model):
|
||||
on_delete=models.SET_NULL,
|
||||
)
|
||||
|
||||
def get_can_edit(self, user):
|
||||
return user in self.admin_role
|
||||
|
||||
def clean_scm_type(self):
|
||||
return self.scm_type or ''
|
||||
|
||||
@@ -328,6 +325,9 @@ class Project(UnifiedJobTemplate, ProjectOptions, ResourceMixin):
|
||||
kwargs['scm_delete_on_update'] = True
|
||||
return kwargs
|
||||
|
||||
def get_can_edit(self, user):
|
||||
return user in self.admin_role
|
||||
|
||||
def create_project_update(self, **kwargs):
|
||||
return self.create_unified_job(**kwargs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user