! ----- VALID_USER.FUN ----- ! ! ----- FUNCTION THAT RETURNS FALSE IF THE PASSED ARGUMENT ----- ! ----- IS A VALID USERNAME IDENTIFIER ----- ! ! ----- Last Change 07/02/93 by Brian Lomasky ----- ! FUNCTION WORD VALID_USER(STRING THE_USER, WORD I_O_CHNL, & WORD SKIP_ERROR_MESSAGES) %INCLUDE "NUSER.INC" EXTERNAL WORD FUNCTION SEARCH_RIGHTSLIST(WORD, WORD, & WORD) ! READ MATCHING RIGHTSLIST REC VALID_USER = TRUE ! ASSUME ERROR STATUS IF DEBUG_MODE THEN PRINT "DEBUG>Call VALID_USER for " + & TRM$(THE_USER) + " on chnl " + NUM1$(I_O_CHNL) END IF ! ----- ERROR IF ARGUMENT IS TOO LONG ----- IF LEN(TRM$(THE_USER)) < 1% OR LEN(TRM$(THE_USER)) > 12% THEN PRINT PRINT "Error - Username argument is" + & " out of range: " + TRM$(THE_USER) + BEL PRINT EXIT FUNCTION END IF ! ----- SEARCH DESIRED RIGHTSLIST.DAT FILE BY ITS ----- ! ----- ALTERNATE KEY #2 TO CHECK FOR A VALID USERNAME ----- KGB_NAME = THE_USER ! STORE USERNAME TO SEARCH FOR IF NOT SEARCH_RIGHTSLIST(I_O_CHNL, 2%, FALSE) THEN EXIT FUNCTION IF SKIP_ERROR_MESSAGES ! ----- PRINT ERROR IF IDENTIFIER IS NOT A ----- ! ----- USERNAME ----- PRINT PRINT "Error - " + TRM$(THE_USER) + & " is not an existing username identifier" + BEL PRINT EXIT FUNCTION END IF IF KGB_IDENTIFIER < 0% THEN ! ERROR IF NOT IN UIC FORMAT ! ----- PRINT ERROR IF IDENTIFIER IS NOT A ----- ! ----- USERNAME ----- PRINT PRINT "Error - " + TRM$(THE_USER) + & " is not a username - it's an identifier" + BEL PRINT EXIT FUNCTION END IF ! ----- SAVE THIS USER'S UIC ----- SEARCH_HOLDER(0%) = KGB_IDENTIFIER VALID_USER = FALSE ! RETURN SUCCESS STATUS END FUNCTION