1 – Setup and customization > 1.3 Viewpoint customization > Customizing navigation components > Adding a custom link to the Viewpoint menu

Adding a custom link to the Viewpoint menu

As an administrator with Viewpoint configuration permissions, you can control which menu options are available to certain users by setting user permissions in roles. For example, if you only want certain users to be able to access the Node Management page, you can limit the access to the page by using the "Node Management" page permission. Only users with this permission will be able to access Node Management page. Additionally, only users with this permission will be able to see the navigation option in the Viewpoint menu. Users without the "Node Management" page permission will not see the menu option. In other words, if you want to certain menu options to appear or hide for different users, you simply restrict or enable the menu option's corresponding page permission.

Menu options are maintained in the navigation.xml file (located in the $VIEWPOINT_HOME/hpc directory). However, you set the page permissions for each menu option by using the Role Management functionality in Viewpoint. For more information, see About role management.

By default, every menu option is available to the super user.

You may want to add a custom navigation link to your Viewpoint menu. These instructions explain how to create the custom link and to set user permissions so that you can restrict its accessibility to certain users.

To add a custom link

  1. First, you will need to go into MWS and create a permission for your custom link (for details, see the "Permissions" resource section of the Moab Web Services Reference Guide).
  2. Let's say, for example, that you want your link to point to an internal company page. You could do the following:

    1. Specify the permission resource (for example, "internalPage").
    2. Specify the action (for example, "read").
    3. Specify the type (in this case, "page").
    4. (Optional, but recommended) Specify a label (for example, "Internal Company Page"). This will be the name of the permission that appears on the Role Management page.
    5. (Optional) Specify a description (for example, "The permission to access the internal company page").

  3. When you create a permission like this, the actual permission name will be in this format: <type>.<resource>.<action> (or in this case, page.internalPage.read).
  4. Any new page permission you create in MWS will appear in the Page Permissions when creating or editing roles. If you want to include the page permission in an existing role, you will have to edit the role and select the new custom page permission. For more information, see Editing an existing role.

  5. Open the navigation.xml file in the $VIEWPOINT_HOME/hpc directory, and locate the <nav-menu> element.
  6. If you want to insert the new link under an existing menu label (for example, "Datacenter" or "Services"), locate the <menu> element where you want the new link to appear. For example:
  7. <menu label="Datacenter">
  8. If you want the link to appear under a new menu label, you can create a new <menu> element and specify the label. For example:
  9. <menu label="Internal">
  10. Inside the <menu> element, insert a new <link> element, and do the following:
    1. Create a label attribute, and specify the display text for the link.
    2. Create a href attribute, and specify the URL to the page you want the menu option to open.
    3. Create a target attribute, and specify one of the following for how the link should be opened:
    4. ValueDescription
      thisWindow Clicking the link exits the Viewpoint web application and displays the new page in the same window.
      newWindow Clicking the link opens the link in a new window (browser tab).
  11. Inside the <link> element, insert a new <permission> element so that you can control which users have access to see the link and access the page.
  12. For example, let's say you are creating a new link under the "Administration" menu label that directs to the internal company page. You want to label the link "Custom Page," and you want it to open in a new window. You also want to restrict access to this page to certain users, so you assign it the new "page.internalPage.read" page permission you created in MWS (see step 1). This is how you would set up the xml:

    <menu label="Administration">
    ...
      <link label="Custom Page" href="http://www.exampleURL.com/example" target="newWindow">
        <permission name="page.internalPage.read"/>
      </link>
    ...
    </menu>
  13. Save the navigation.xml file.
  14. Your changes will update automatically. No restart of Tomcat or of Viewpoint is necessary. However, you must log out of Viewpoint and log back in.

  15. Go to the Role Management page and add the permission to a new or existing role. For more information, see About role management.

Related topics