Ignoring adopted authority

The technique of using adopted authority in menu design requires the user to return to the initial menu before running queries. If you want to provide the convenience of starting query from application menus as well as from the initial menu, you can set up the QRYSTART program to ignore adopted authority.

Figure 1 shows an application menu that includes the QRYSTART program:

Figure 1. Sample application menu with query
  ICMENU       Inventory Control Menu
 
               1.  Issues (ICPGM1)
               2.  Receipts (ICPGM2)
               3.  Purchases (ICPGM3)
               4.  Query  (QRYSTART)
 
  (no command line)

The authority information for the QRYSTART program is the same as shown in Table 2. The program is created with the use adopted authority (USEADPAUT) parameter set to *NO, to ignore the adopted authority of previous programs in the stack.

Here are comparisons of the call stacks when USERA selects query from MENU1 (see Figure 1) and from ICMENU:
Call stack when query selected from MENU1
  • MENU1 (no adopted authority)
  • QRYSTART (adopted authority QRYUSR)
Call stack when query selected from ICMENU
  • MENU1 (no adopted authority)
  • ICMENU (adopted authority OWNIC)
  • QRYSTART (adopted authority QRYUSR)

By specifying the QRYSTART program with USEADPAUT(*NO), the authority of any previous programs in the stack is not used. This allows USERA to run a query from ICMENU without having the ability to change and delete files. This is because the authority of OWNIC is not used by the QRYSTART program.

When USERA ends the query and returns to ICMENU, adopted authority is once again active. Adopted authority is ignored only as long as the QRYSTART program is active.

If public authority to the QRYSTART program is *USE, specify USEADPAUT(*NO) as a security precaution. This prevents anyone running under adopted authority from calling the QRYSTART program and performing unauthorized functions.

The inquiry menu (Figure 1) at the JKL Toy Company also uses this technique, because it can be called from menus in different application libraries. It adopts the authority of QRYUSR and ignores any other adopted authority in the call stack.