1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

Merge pull request #2354 from wwitzel3/issue-2124

anyone with read_role should be able to view /update
This commit is contained in:
Wayne Witzel III 2016-06-14 10:16:19 -04:00 committed by GitHub
commit b24ad639bf

View File

@ -195,8 +195,17 @@ class ProjectUpdatePermission(ModelAccessPermission):
'''
Permission check used by ProjectUpdateView to determine who can update projects
'''
def check_get_permission(self, request, view, obj=None):
if request.user.is_superuser:
return True
def has_permission(self, request, view, obj=None):
project = get_object_or_400(view.model, pk=view.kwargs['pk'])
if project and request.user in project.read_role:
return True
return False
def check_post_permission(self, request, view, obj=None):
if request.user.is_superuser:
return True