diff --git a/CHANGES.rst b/CHANGES.rst index 629014d1..4fc25d98 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,8 @@ Changelog 6.2.17 (unreleased) ------------------- -- Nothing changed yet. +- The permission to view the ModelloPratica has been made parametric. + [lucabel] 6.2.16 (2024-09-06) diff --git a/src/design/plone/contenttypes/restapi/serializers/dxfields.py b/src/design/plone/contenttypes/restapi/serializers/dxfields.py index 1f8ce119..10080bb4 100644 --- a/src/design/plone/contenttypes/restapi/serializers/dxfields.py +++ b/src/design/plone/contenttypes/restapi/serializers/dxfields.py @@ -189,6 +189,9 @@ def get_item_children(item): @adapter(ITextLine, IServizio, IDesignPloneContenttypesLayer) class ServizioTextLineFieldSerializer(DefaultFieldSerializer): + + PERMISSION_TO_CHECK = "View" + def __call__(self): value = self.get_value() if self.field.getName() != "canale_digitale_link" or not value: @@ -204,7 +207,7 @@ def __call__(self): if api.user.is_anonymous(): target = uuidToObject(uid, unrestricted=True) value = target.absolute_url() - if not api.user.has_permission("View", obj=target): + if not api.user.has_permission(self.PERMISSION_TO_CHECK, obj=target): value = f"{value}/login" else: value = uuidToURL(uid)