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."
# 'dc_url': reverse('docdc_view', args=[doc.id]),
'gallery_url': reverse('docgallery_view', args=[doc.id]),
'merge_url': reverse('docmerge_view', args=[doc.id]),
- 'user_revision': doc.revision,
- 'user_timestamp': doc.revision.timestamp,
+ 'revision': doc.revision,
+ 'timestamp': doc.revision.timestamp,
# 'public_revision': doc.revision,
# 'public_timestamp': doc.revision.timestamp,
}
# 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
"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:
# 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
return response.SuccessAllOk().django_response({
"name": user_doc_new.id,
"user": user_doc_new.owner,
- "parent_revision": user_doc_new.revision,
- "parent_shared_revision": doc.revision,
+
"revision": user_doc_new.revision,
- "shared_revision": doc_new.revision,
'timestamp': user_doc_new.revision.timestamp,
+
+ "parent_revision": user_doc_new.revision,
+ "parent_timestamp": user_doc_new.revision.timestamp,
+
+ "shared_revision": doc_new.revision,
+ "shared_timestamp": doc_new.revision.timestamp,
+
+ "shared_parent_revision": doc.revision,
+ "shared_parent_timestamp": doc.revision.timestamp,
})
\ No newline at end of file