Skip to content
Snippets Groups Projects
Verified Commit 8a6120a6 authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

feat: check field level permission to display internal note

parent 1c1017d9
No related branches found
No related tags found
No related merge requests found
......@@ -530,14 +530,11 @@ class ShowSerializer(serializers.HyperlinkedModelSerializer):
) + read_only_fields
def get_internal_note(self, obj) -> str:
"""Only members of the privileged group can see the internal note."""
"""Only users with the permission can see the internal note."""
user = self.context.get("request").user
if user.groups.filter(name=settings.PRIVILEGED_GROUP).exists():
return obj.internal_note
else:
return ""
return obj.internal_note if user and user.has_perm("display__show__internal_note") else ""
def create(self, validated_data):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment