diff --git a/backend/core/serializers.py b/backend/core/serializers.py index 7728c4c70..1c8c0e377 100644 --- a/backend/core/serializers.py +++ b/backend/core/serializers.py @@ -462,3 +462,14 @@ class RequirementAssessmentWriteSerializer(BaseModelSerializer): class Meta: model = RequirementAssessment fields = "__all__" + +class LibraryReadSerializer(BaseModelSerializer): + class Meta: + model = Library + fields = "__all__" + + +class LibraryWriteSerializer(BaseModelSerializer): + class Meta: + model = Library + fields = "__all__" diff --git a/backend/library/views.py b/backend/library/views.py index e5498266d..54970328e 100644 --- a/backend/library/views.py +++ b/backend/library/views.py @@ -21,7 +21,7 @@ from core.helpers import get_sorted_requirement_nodes from core.models import Library from core.views import BaseModelViewSet -from iam.models import RoleAssignment, Folder +from iam.models import RoleAssignment, Folder, Permission from library.validators import validate_file_extension from .helpers import preview_library @@ -42,9 +42,10 @@ class LibraryViewSet(BaseModelViewSet): def list(self, request, *args, **kwargs): if not RoleAssignment.is_access_allowed( user=request.user, - perm="view_library", + perm=Permission.objects.get(codename="view_library"), folder=Folder.get_root_folder(), ): + print("coucou") return Response( status=status.HTTP_403_FORBIDDEN, )