Commit 71af2d18 authored by Michal Čihař's avatar Michal Čihař

Fix permission check on operations

The original code was too restrictive and didn't allow some users to
trigger pull/push.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 8302042f
......@@ -106,9 +106,6 @@ class WeblateViewSet(viewsets.ReadOnlyModelViewSet):
else:
project = obj
if not can_see_repository_status(request.user, project):
raise PermissionDenied()
if request.method == 'POST':
serializer = RepoRequestSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
......@@ -117,6 +114,9 @@ class WeblateViewSet(viewsets.ReadOnlyModelViewSet):
request, obj, project, serializer.validated_data['operation']
)
if not can_see_repository_status(request.user, project):
raise PermissionDenied()
return Response(
data={
'needs_commit': obj.repo_needs_commit(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment