Guardian Programmer's Guide

Table Of Contents
Writing a Command-Interpreter Monitor ($CMON)
Guardian Programmer’s Guide 421922-014
23 - 26
Controlling Deleting a User
The following code fragment rejects any attempt to add a user except by a super-group
user (255, n):
CALL READUPDATEX(RECV^NUM,SBUFFER,RCOUNT,BYTES^READ);
IF BUFFER[0] = -54 THEN
BEGIN
REQUESTING^GROUP^ID := ADDUSER^MSG.USERID.<0:7>;
IF REQUESTING^GROUP^ID = 255
THEN ADDUSER^REPLY.REPLY^CODE := 0
ELSE ADDUSER^REPLY.REPLY^CODE := 1;
REPLY^LEN := 2;
CALL REPLYX(ADDUSER^REPLY,REPLY^LEN);
END;
Controlling Deleting a User
When a user attempts to delete another user from the system using the DELUSER
command, the DELUSER process sends a Deluser^msg message to $CMON to verify
the request. The $CMON process can either accept the request as it is or reject it.
Note that for the user to delete a user from the system, one of the following must be
true:
The user issuing the command is the group manager (n, 255) of the user to be
deleted.
The user issuing the command is the super ID (255, 255).
If neither of the above is true, then the requesting user cannot perform the deletion,
regardless of $CMON.
The format of the Deluser^msg message is as follows:
Format of command-interpreter message -55 (Deluser^msg message):
STRUCT DELUSER^MSG;
BEGIN
INT MSGCODE; ![0] value -55
INT USERID; ![1] user ID of user requesting
! to delete
INT CIPRI; ![2] initial priority of command
! interpreter
INT CIINFILE[0:11]; ![3] name of command file of
! TACL process
INT CIOUTFILE[0:11]; ![15] name of list file for the
! TACL process
INT GROUPNAME[0:3]; ![27] the group name of the user
! being deleted
INT USERNAME[0:3]; ![31] name of the user being
! deleted
END;