Guardian Programmer's Guide

Table Of Contents
Writing a Command-Interpreter Monitor ($CMON)
Guardian Programmer’s Guide 421922-014
23 - 24
Controlling Adding and Deleting Users
The following code fragment allows the priority to be reduced but not increased:
CALL READUPDATEX(RECV^NUM,SBUFFER,RCOUNT,BYTES^READ);
IF BUFFER[0] = -56 THEN
BEGIN
ALTPRI^MSG ':=' SBUFFER FOR BYTES^READ;
ERROR := PROCESS_GETINFO_(ALTPRI^MSG.PROCESS^HANDLE,
!file^name:maxlen!,
!file^name^len!,
PRIORITY);
IF ERROR <> 0 THEN
BEGIN
ALTPRI^REPLY.REPLYCODE = 1;
END
ELSE
BEGIN
IF PRIORITY > ALTPRI^MSG.PRIORITY
THEN ALTPRI^REPLY.REPLYCODE = 0
ELSE ALTPRI^REPLY.REPLYCODE = 1;
END;
REPLY^LEN := 2;
CALL REPLYX(ALTPRI^REPLY,REPLY^LEN);
END;
Controlling Adding and Deleting Users
Attempts to add or delete users can be controlled by the $CMON process. The
ADDUSER or DELUSER process asks $CMON for verification when a user issues an
ADDUSER or DELUSER command.
Controlling Adding a User
When a user attempts to add a user to the system using the ADDUSER command, the
ADDUSER process sends an Adduser^msg message to the $CMON process to verify
the request. $CMON can either accept the request as it is or reject it.
Note that for a user to add a new user to the system, one of the following must be true:
The user issuing the command is the group manager (n, 255) of the new user.
The user issuing the command is the super ID (255, 255).
If neither of the above is true, then the user cannot add a new user, regardless of
$CMON.