mirror of
https://github.com/ansible/awx.git
synced 2026-06-23 23:57:52 -02:30
enforce read access for team/child roles
This commit is contained in:
@@ -170,8 +170,8 @@ class BaseAccess(object):
|
||||
return bool(self.can_change(obj, None) and
|
||||
self.user.can_access(type(sub_obj), 'read', sub_obj))
|
||||
|
||||
def can_unattach(self, obj, sub_obj, relationship):
|
||||
return self.can_change(obj, None)
|
||||
def can_unattach(self, obj, sub_obj, relationship, data=None):
|
||||
return self.can_change(obj, data)
|
||||
|
||||
def check_license(self, add_host=False, feature=None, check_expiration=True):
|
||||
reader = TaskSerializer()
|
||||
@@ -1594,11 +1594,11 @@ class RoleAccess(BaseAccess):
|
||||
|
||||
def can_attach(self, obj, sub_obj, relationship, data,
|
||||
skip_sub_obj_read_check=False):
|
||||
return self.can_unattach(obj, sub_obj, relationship)
|
||||
return self.can_unattach(obj, sub_obj, relationship, data, skip_sub_obj_read_check)
|
||||
|
||||
@check_superuser
|
||||
def can_unattach(self, obj, sub_obj, relationship):
|
||||
if relationship == 'members':
|
||||
def can_unattach(self, obj, sub_obj, relationship, data=None, skip_sub_obj_read_check=False):
|
||||
if not skip_sub_obj_read_check and relationship in ['members', 'member_role.parents']:
|
||||
if not check_user_access(self.user, sub_obj.__class__, 'read', sub_obj):
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user