Skip to content

Commit

Permalink
Fix library read error
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-intuitem committed Feb 23, 2024
1 parent a0630b8 commit 9e541e6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 11 additions & 0 deletions backend/core/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__"
5 changes: 3 additions & 2 deletions backend/library/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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,
)
Expand Down

0 comments on commit 9e541e6

Please sign in to comment.