minor cleanup
authorJan Szejko <janek37@gmail.com>
Fri, 31 Mar 2017 08:17:50 +0000 (10:17 +0200)
committerJan Szejko <janek37@gmail.com>
Fri, 31 Mar 2017 08:17:50 +0000 (10:17 +0200)
apps/catalogue/templatetags/document_list.py
apps/catalogue/views.py

index f9de2d6..470839a 100755 (executable)
@@ -64,11 +64,7 @@ def document_list(context, user=None, organization=None):
 @register.inclusion_tag('catalogue/book_list/book.html', takes_context=True)
 def document_short_html(context, doc):
     user = context['request'].user
-    if doc.owner_organization is not None:
-        am_owner = doc.owner_organization.is_member(user)
-    else:
-        am_owner = doc.owner_user == user
     return {
-        'am_owner': am_owner,
+        'am_owner':doc.can_edit(user),
         'book': doc,
     }
index 1021c87..2e82dfa 100644 (file)
@@ -353,9 +353,6 @@ def book_owner(request, pk):
     doc = get_object_or_404(Document, pk=pk, deleted=False)
     if not doc.can_edit(request.user):
         return HttpResponseForbidden("Not authorized.")
-    user_is_owner = doc.owner_organization and doc.owner_organization.is_member(request.user)
-    if not (doc.owner_user == request.user or user_is_owner):
-        raise Http404
 
     error = ''