X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/020ad779bc86249cd11cb8aa4970420b16789f55..5a8f55e2911b9a6aa38499da2c54b6068152f1cf:/apps/api/handlers/library_handlers.py?ds=sidebyside diff --git a/apps/api/handlers/library_handlers.py b/apps/api/handlers/library_handlers.py index 2b1edb21..607ac959 100644 --- a/apps/api/handlers/library_handlers.py +++ b/apps/api/handlers/library_handlers.py @@ -42,14 +42,14 @@ def check_user(request, user): log.info("user: %r, perm: %r" % (request.user, request.user.get_all_permissions()) ) #pull request if is_prq(user): - if not request.user.has_perm('api.pullrequest.can_view'): + if not request.user.has_perm('api.view_prq'): yield response.AccessDenied().django_response({ 'reason': 'access-denied', 'message': "You don't have enough priviliges to view pull requests." }) # other users elif request.user.username != user: - if not request.user.has_perm('api.document.can_view_other'): + if not request.user.has_perm('api.view_other_document'): yield response.AccessDenied().django_response({ 'reason': 'access-denied', 'message': "You don't have enough priviliges to view other people's document." @@ -628,6 +628,8 @@ class MergeHandler(BaseHandler): # update user document if changed: user_doc_new = user_doc.latest() + else: + user_doc_new = user_doc # shared document is the same doc_new = doc @@ -646,7 +648,7 @@ class MergeHandler(BaseHandler): "message": "There are unresolved conflicts in your file. Fix them, and try again." }) - if not request.user.has_perm('api.document.can_share'): + if not request.user.has_perm('api.share_document'): # User is not permitted to make a merge, right away # So we instead create a pull request in the database try: @@ -680,6 +682,8 @@ class MergeHandler(BaseHandler): # update shared version if needed if changed: doc_new = doc.latest() + else: + doc_new = doc # the user wersion is the same user_doc_new = base_doc