Skip to content

Commit

Permalink
fix: tighten permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Mar 28, 2024
1 parent 62c1857 commit 09e7ab0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions sicprod/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@
def apis_view_passes_test(view) -> bool:
if view.request.user.is_authenticated:
return True
obj = view.get_object()
from apis_core.collections.models import SkosCollectionContentObject
from django.contrib.contenttypes.models import ContentType
ct = ContentType.objects.get_for_model(obj)
return SkosCollectionContentObject.objects.filter(content_type=ct, object_id=obj.id, collection__name="published").exists()
if view.permission_action_required == "view":
obj = view.get_object()
from apis_core.collections.models import SkosCollectionContentObject
from django.contrib.contenttypes.models import ContentType
ct = ContentType.objects.get_for_model(obj)
return SkosCollectionContentObject.objects.filter(content_type=ct, object_id=obj.id, collection__name="published").exists()
return False


# we have to set this, otherwise there is an error
Expand Down

0 comments on commit 09e7ab0

Please sign in to comment.