HPlogo Command Interpreter Access and Variables Programmer's Guide: Series HP 3000 Computer Systems > Chapter 7 Sample Command Files

To Add User Capabilities

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

The ADDCAP command file adds capabilities to a user's capability list. The ALTUSER command is used to alter the capability list. The AM capability, therefore, is required to execute this command file. Since the new capability does not become effective until the user logs on again, the user is offered the option of being logged on automatically. This command also permits an authorized user to change the UID of a user. Refer to New Features of MPE/iX: Using The Hierarchical File System (32650-90351).

Figure 7-5 Additional Capability Command File

PARM CAP=""

IF ("!CAP"="") THEN

  ECHO (ADDCAP): Your capabilities are: !HPUSERCAPF.

  RETURN

ENDIF

IF (POS(UPS("!CAP"),HPUSERCAPF) <> 0) THEN

  ECHO (ADDCAP): You already have    : !CAP.

  ECHO (ADDCAP): The capabilities are: !HPUSERCAPF.

  RETURN

ENDIF

SETVAR CIERROR 0

CONTINUE

ALTUSER !HPUSER;CAP=![HPUSERCAPF + ",!CAP"]

IF CIERROR <> 0 THEN

  ECHO (ADDCAP): The capabilities remain: !HPUSERCAPF.

ELSE

  ECHO (ADDCAP): !HPUSER new capabilities are: ![HPUSERCAPF + ",!CAP"].

  SETVAR ADDCAP_TEMP "N"

  INPUT ADDCAP_TEMP,"(ADDCAP): Log off/on now (Y/N) ==>",10

  IF HPCIERR = -9003 THEN

    COMMENT ** TIMED READ EXPIRED **

    ECHO

    ECHO (ADDCAP): Timed 10-second read expired.  &

                   Logon cancelled.

  ELSEIF NOT(UPS(LFT(ADDCAP_TEMP,1)) = "Y") THEN

      ECHO (ADDCAP): New capabilities take effect at next &

                     logon.

  ELSE

    HELLO !HPJOBNAME,!HPUSER.!HPACCOUNT,!HPGROUP

  ENDIF

ENDIF

DELETEVAR ADDCAP_TEMP

COMMENT ** END OF ADDCAP **

An error routine is triggered by the contents of CIERROR. If an unacceptable parameter is entered, the CIERROR field is updated and the capabilities remain as they were.

There are three possible outcomes in running this command file using acceptable input:

  • No capability was entered as a parameter value. The user's current capabilities are listed.

  • The user already has the capability.

  • The capability is added to the user's list. Note that a relogging option prompts the user to relog automatically or to wait until the next logon to activate the new capabilities.

The following examples illustrate these three possibilities.

Figure 7-6 ADDCAP Sample Output

:ADDCAP

(ADDCAP): Your capabilities are: AM,BA,IA





:ADDCAP AM

(ADDCAP): You already have    : AM

(ADDCAP): The capabilities are: AM,BA,IA





:ADDCAP DS

(ADDCAP): SAMPLE new capabilities are: AM,BA,IA,DS

(ADDCAP): Log off/on now Y/N ==>



(ADDCAP): Timed 10-second read expired.  Logon cancelled.
Feedback to webmaster