Do you have some feature in mind that you'd love to see in Couch? Let us know.
5 posts Page 1 of 1
When building the menu using nested_pages, it would be great to be able to know the access level of the current menu item. If that variable would be available, I can build up a menu while taking the access level of the currently logged in user into account.

The new variable name would be for instance: k_menu_access_level.
I can match it against k_user_access_level.

For instance:
Code: Select all
<cms:nested_pages masterpage='index.php' extended_info='1' >
[...]
               <cms:if k_user_access_level ge k_menu_access_level >
                        <a class="nav-link" href="<cms:show k_menu_link />">
                           <cms:show k_menu_title /><span class="sr-only"> (current)</span>
                        </a>
               </cms:if>
[...]
</cms:nested_pages>


Please consider adding this to Couch CMS.
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
Boink! On our website we have three kinds of users with elevated rights:
- members (who can see member pages, not the admin pages)
- editors (who can post news items and see a few other things, and therefore can see the admin pages)
- administrators (who can fully access and use the admin pages)

In my "Admin" menu I would therefore like to to evaluate the access level of the current menu item, compare it to the access level of the current user, and decide whether or not to display the menu item.

This is a real need. Is this something that could be considered for a next version?

Thanks
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
Hi,

Can this use-case not be handled by adding an editable region (dropdown or radio) that allows specifying the minimum access level allowed to access the page? Your thoughts?
Hi KK, Yes it can be done of course. I implemented something similar already for a slightly different use case (to allow or deny access to downloadable documents). But I was hoping to leverage the already existing page access rights, which are set in the advanced options of the site's structure in index.php. Because when set separately, one can forget to set one or the other and the two authorisation systems may differentiate over time. Will implement as you suggested in the mean time.
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
KK added this new variable to the Github version of Couch: k_access_level
This variable holds the access level of the current menu item.

I have implemented this as follows in my code, resulting in menu items not being shown if the user has a lower access level than it requires:
Code: Select all
<cms:nested_pages masterpage='index.php' extended_info='1' >
[...]
               <cms:if k_user_access_level ge k_access_level >
                        <a class="nav-link" href="<cms:show k_menu_link />">
                           <cms:show k_menu_title /><span class="sr-only"> (current)</span>
                        </a>
               </cms:if>
[...]
</cms:nested_pages>

Many thanks KK!
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
5 posts Page 1 of 1