mirror of
https://github.com/ansible/awx.git
synced 2026-04-05 10:09:20 -02:30
Explain the RBAC model around inventory usage and adapt a view to match.
This commit is contained in:
@@ -266,11 +266,15 @@ class InventoryList(BaseList):
|
||||
if self.request.user.is_superuser:
|
||||
return base.all()
|
||||
admin_of = base.filter(organization__admins__in = [ self.request.user ]).distinct()
|
||||
has_perms = base.filter(
|
||||
has_user_perms = base.filter(
|
||||
permissions__user__in = [ self.request.user ],
|
||||
permissions__permission_type__in = PERMISSION_TYPES_ALLOWING_INVENTORY_READ,
|
||||
).distinct()
|
||||
return admin_of | has_perms
|
||||
has_team_perms = base.filter(
|
||||
permissions__team__in = self.request.user.teams.all(),
|
||||
permissions__permission_type__in = PERMISSION_TYPES_ALLOWING_INVENTORY_READ,
|
||||
).distinct()
|
||||
return admin_of | has_user_perms | has_team_perms
|
||||
|
||||
class InventoryDetail(BaseDetail):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user