Skip to content

Commit

Permalink
adds is_viewable_by_context_user template tag
Browse files Browse the repository at this point in the history
  • Loading branch information
jontsai committed Aug 11, 2024
1 parent d1d16fd commit c4bb8fb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions templatetags/htk_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,16 @@ def is_feature_enabled(feature_name):
# ACL Tags


@register.simple_tag(takes_context=True)
def is_viewable_by_context_user(context, obj):
user = context.get('user', None)
if user:
is_viewable = obj.is_viewable_by(user)
else:
is_viewable = False
return is_viewable


@register.simple_tag(takes_context=True)
def is_editable_by_context_user(context, obj):
user = context.get('user', None)
Expand Down

0 comments on commit c4bb8fb

Please sign in to comment.