Skip to content
Discussion options

You must be logged in to vote

Just added new element authorization global Twig functions for Craft 4.3 (canView(), canSave(), etc.), which have element and user arguments, but user is optional and defaults to the current user. So you will be able to do this:

{% if not canView(entry) %}
    {% redirect siteUrl %}
{% endif %}

See details in the PR (#11808).

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@mmikkel
Comment options

@brandonkelly
Comment options

Answer selected by brandonkelly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants