mirror of
https://github.com/ansible/awx.git
synced 2026-04-09 12:09:20 -02:30
Initial removal of InventorySource.group
This commit is contained in:
@@ -346,10 +346,6 @@ class BaseAccess(object):
|
||||
elif display_method == 'copy' and isinstance(obj, WorkflowJobTemplate) and obj.organization_id is None:
|
||||
user_capabilities[display_method] = self.user.is_superuser
|
||||
continue
|
||||
elif display_method in ['start', 'schedule'] and isinstance(obj, Group):
|
||||
if obj.inventory_source and not obj.inventory_source._can_update():
|
||||
user_capabilities[display_method] = False
|
||||
continue
|
||||
elif display_method in ['start', 'schedule'] and isinstance(obj, (Project)):
|
||||
if obj.scm_type == '':
|
||||
user_capabilities[display_method] = False
|
||||
@@ -725,9 +721,8 @@ class GroupAccess(BaseAccess):
|
||||
return True
|
||||
|
||||
def can_start(self, obj, validate_license=True):
|
||||
# Used as another alias to inventory_source start access for user_capabilities
|
||||
if obj and obj.inventory_source:
|
||||
return self.user.can_access(InventorySource, 'start', obj.inventory_source, validate_license=validate_license)
|
||||
if obj and obj.inventory:
|
||||
return self.user.can_access(Inventory, 'start', obj.inventory, validate_license=validate_license)
|
||||
return False
|
||||
|
||||
|
||||
@@ -747,9 +742,7 @@ class InventorySourceAccess(BaseAccess):
|
||||
Q(group__inventory_id__in=inventory_ids))
|
||||
|
||||
def can_read(self, obj):
|
||||
if obj and obj.group:
|
||||
return self.user.can_access(Group, 'read', obj.group)
|
||||
elif obj and obj.inventory:
|
||||
if obj and obj.inventory:
|
||||
return self.user.can_access(Inventory, 'read', obj.inventory)
|
||||
else:
|
||||
return False
|
||||
@@ -760,9 +753,9 @@ class InventorySourceAccess(BaseAccess):
|
||||
|
||||
def can_change(self, obj, data):
|
||||
# Checks for admin or change permission on group.
|
||||
if obj and obj.group:
|
||||
if obj and obj.inventory:
|
||||
return (
|
||||
self.user.can_access(Group, 'change', obj.group, None) and
|
||||
self.user.can_access(Inventory, 'change', obj.inventory, None) and
|
||||
self.check_related('credential', Credential, data, obj=obj, role_field='use_role')
|
||||
)
|
||||
# Can't change inventory sources attached to only the inventory, since
|
||||
@@ -771,9 +764,7 @@ class InventorySourceAccess(BaseAccess):
|
||||
return False
|
||||
|
||||
def can_start(self, obj, validate_license=True):
|
||||
if obj and obj.group:
|
||||
return obj.can_update and self.user in obj.group.inventory.update_role
|
||||
elif obj and obj.inventory:
|
||||
if obj and obj.inventory:
|
||||
return obj.can_update and self.user in obj.inventory.update_role
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user