As far as I understand, in Apostrophe CMS an authenticated, non-guest user is always an editor, with more or less edition rights depending on the setup, but always a person who accessed to edit content, so all the Apostrophe UI pops as soon as you log in. However, in the usual workflow/requirements in my websites, users (as in "visitors") need to to login in order to access some specific pages or functionalities not available for guest visitors, so we end up with 3 different types of users: guest visitors, authenticated visitors and editors.
At the moment, in order to be able to have authenticated non-editor users, I've tried overriding the blocks apostropheMenu
and apostropheContextMenu
in views\layout.html
to something like this.
{% block apostropheMenu %}
{% if userHasEditorPermissions %}
{{ super()}}
{% if asdf %}
{% endblock %}
Is this the right way to do so or is there a better alternative? The original "apostropheMenu" block checks if data.user
exists in order to show or not the UI, should I check the permissions directly in data.user or add that functionality in a beforeShow()
?
Kind regards and thanks to the Apostrophe team!
I think some variation of template checking would be a good way to do it.
Set up an apostrophe-group
specifically for your authenticated guests (give them the Guest permission privilege) and then check against that specific group in your template, looking inside data.user._groups
and deciding whether or not to render certain UI.