Skip to content

Commit

Permalink
update permission
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-bellenghi committed Sep 6, 2024
1 parent 2778ba4 commit f6930b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down

0 comments on commit f6930b6

Please sign in to comment.