Hiding a page from SideSubMenu navigation based on permissions

#1

Is there a way to hide a page from submenu (C3.view.menu.SideSubMenu) navigation programmatically, depending on a user’s permissions/PageGroups?

For example, I have a map page with navigation from the submenu, and some users do not have access to this map. Currently a user without access to this page can see “Map” on the submenu, and clicking that navigation shows a blank page with a data load error message (this is expected, as this user shouldn’t have access to this functionality).

Desired behavior is to remove the Map navigation completely for this user, so they cannot even go to that page in the first place from the UI. This navigation should exist for users with access to the map.

0 Likes

#2

First, make sure UI ACLs are turned on. Check that your UIConfig has an environment with acl set to true.
Example:

{
    "id": "uiconfig",
    ...
    "environments": [
        {
            "id": "development",
            ...
            "acl": true
        }
    ]
}

If that is true and it is still not working, make sure the sub-menu item has either: 1) appId and pageId configured, or 2) a permission object configured. Here are some examples:

"items": [
    {
        "id": "page1",
        "title": "Page 1",
        "appId": "MyApp",
        "pageId": "PageOne"
    },
    {
        "id": "page2",
        "title": "Page 2",
        "permission": {
             "permissionType": "adminGroup",
             "access": "allow",
             "permissions": [
                 "FirstAdminGroup",
                 "SecondAdminGroup"
             ]
         }
    }
]
2 Likes

#3

This should already be working. There is code that checks each menu item, to make sure the page it links to is viewable by the user (depending on which group they’re in). Make sure the page group is properly deployed to the environment, and that the user is in the group that has view access to the page.

2 Likes