From 6e77edcf67db120815e5380b3739a74de21e6047 Mon Sep 17 00:00:00 2001 From: Julien Constant Date: Tue, 9 Aug 2022 17:57:02 +0200 Subject: [PATCH 1/2] Fix 'download all my picture button' being displayed in all albums sections --- core/templates/core/user_pictures.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/templates/core/user_pictures.jinja b/core/templates/core/user_pictures.jinja index b467c3bb..d2ee9844 100644 --- a/core/templates/core/user_pictures.jinja +++ b/core/templates/core/user_pictures.jinja @@ -5,8 +5,8 @@ {% endblock %} {% block content %} -{% for a in albums %} +{% for a in albums %}

{{ a.name }}


From 7c4c1bc38702847dd5f9cdd0191f3b64e4b12452 Mon Sep 17 00:00:00 2001 From: Sli Date: Tue, 9 Aug 2022 18:11:20 +0200 Subject: [PATCH 2/2] Fix permissions on download pictures feature --- api/views/sas.py | 4 ++-- core/templates/core/user_pictures.jinja | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/views/sas.py b/api/views/sas.py index 277ed390..063b9eab 100644 --- a/api/views/sas.py +++ b/api/views/sas.py @@ -6,7 +6,7 @@ from rest_framework.renderers import JSONRenderer from rest_framework.request import Request from rest_framework.response import Response -from core.views import can_edit_prop +from core.views import can_edit from core.models import User from sas.models import Picture @@ -24,7 +24,7 @@ def all_pictures_of_user(user: User) -> List[Picture]: @renderer_classes((JSONRenderer,)) def all_pictures_of_user_endpoint(request: Request, user: int): requested_user: User = get_object_or_404(User, pk=user) - if not can_edit_prop(requested_user, request.user): + if not can_edit(requested_user, request.user): raise PermissionDenied return Response( diff --git a/core/templates/core/user_pictures.jinja b/core/templates/core/user_pictures.jinja index d2ee9844..2d4e26a0 100644 --- a/core/templates/core/user_pictures.jinja +++ b/core/templates/core/user_pictures.jinja @@ -5,7 +5,9 @@ {% endblock %} {% block content %} - + {% if can_edit(profile, user) %} + + {% endif %} {% for a in albums %}

{{ a.name }}