Howto: Define a Menu using GAM

Using GeneXus Access Manager (GAM), your WEB application menu can be defined (dynamically) at runtime, based on the GAM Permissions and GAM Roles of the user logged-in.

The purpose is to filter the menu options according to the end user's permissions. Here, GAM returns the menu structure depending on the permissions of the user so that this structure may be loaded at runtime with any User Control.

Description of a Menu related to GAM applications

The menu is always related to a GAM Application, so it has to be defined for a particular GAM Application.

Graphically, a GAM Repository can be related to N GAM Applications, and N Menus may be defined within a GAM Application.

i2015_12_29_13_14_551_png

The Menu is associated with resources (any object that may be executed from the URL).

Each of these resources needs a permission that will condition its execution. And there are two possibilities:

  1. The object associated with that resource has Integrated Security Level property = Authorization, so GeneXus generates a permission to execute that resource (see Automatic Permissions generated by GeneXus).
  2. A GAM custom permission associated with that resource has been defined. See Permissions Created by the User. Note that in this particular case, the permission is used only to decide whether to show the menu option to the user or not. In other words, the permission isn't checked at the execution of the resource itself. 

How to define the menu

The menu may be set using the GAM Web Backoffice or the GAM API for this purpose (see Update GAM Menu options).

1. Select the GAM application where you will define the Menu, and click on the menu option:

GAMApplicationMenus

2. Click to add a Menu

Add Menu Salto

3. Define the Menu name and description

Menu definition Salto

4. Add the Menu options

Adding Menu options Salto

5. When you add a Menu option, you will get a dialog like this:

Menu options Salto

The option type can be

  • Simple
  • Menu (a submenu may be defined here)

The resource value is selected from a combo box that shows the Application's permissions. Each permission is related to N resources, so the desired resource and permission must be selected.

Resource Permissions Salto

The menu is defined automatically, based on the permissions of the resources and the user's GAM Roles. The end user will view only the Menu options linked to resources associated with the permissions that the user may access.

The menu may be displayed using any User Control. See Howto: Display a GAM Menu using Jscookmenu UC.

Note 

The Menu of the GAM Web Backoffice is automatically defined in the GAM Backend Application. It is created when Creating the GAM repository for the first time from GeneXus.