@ECHO OFF
REM RUTPRE.BAT
REM Rights User Test PREP.
REM
REM Run as SUPERVISOR.
REM Creates test tree and grants selected trustee rights to user MARIO.
REM
REM Test tree:
REM   F:\RUTEST
REM
REM Results:
REM   F:\RUCMP\PRE\*.OUT
REM   F:\RUCMP\RUN.LOG

F:
CD \

REM --- Clean generated test/result directories (contents only). ---
IF EXIST RUTEST\NUL DELTREE /Y RUTEST\*.*
IF EXIST RUCMP\NUL DELTREE /Y RUCMP\*.*

IF NOT EXIST RUTEST\NUL MD RUTEST
IF NOT EXIST RUTEST\RONLY\NUL MD RUTEST\RONLY
IF NOT EXIST RUTEST\CREATE\NUL MD RUTEST\CREATE
IF NOT EXIST RUTEST\WRITE\NUL MD RUTEST\WRITE
IF NOT EXIST RUTEST\ERASE\NUL MD RUTEST\ERASE
IF NOT EXIST RUTEST\SCAN\NUL MD RUTEST\SCAN
IF NOT EXIST RUTEST\ACCESS\NUL MD RUTEST\ACCESS
IF NOT EXIST RUTEST\ALL\NUL MD RUTEST\ALL
IF NOT EXIST RUTEST\MOD1\NUL MD RUTEST\MOD1
IF NOT EXIST RUTEST\MOD2\NUL MD RUTEST\MOD2
IF NOT EXIST RUTEST\MOD3\NUL MD RUTEST\MOD3
IF NOT EXIST RUTEST\MOD4\NUL MD RUTEST\MOD4
IF NOT EXIST RUCMP\NUL MD RUCMP
IF NOT EXIST RUCMP\PRE\NUL MD RUCMP\PRE
IF NOT EXIST RUCMP\MARIO\NUL MD RUCMP\MARIO
IF NOT EXIST RUCMP\POST\NUL MD RUCMP\POST
IF NOT EXIST RUCMP\CMP\NUL MD RUCMP\CMP

IF EXIST F:\RUCMP\RUN.LOG DEL F:\RUCMP\RUN.LOG
IF EXIST F:\RUCMP\SUMMARY.TXT DEL F:\RUCMP\SUMMARY.TXT
IF EXIST F:\RUCMP\RUTSTA.ZIP DEL F:\RUCMP\RUTSTA.ZIP
IF EXIST F:\RUCMP\ZIP.LOG DEL F:\RUCMP\ZIP.LOG

IF EXIST F:\RUCMP\PRE\*.OUT DEL F:\RUCMP\PRE\*.OUT
IF EXIST F:\RUCMP\MARIO\*.OUT DEL F:\RUCMP\MARIO\*.OUT
IF EXIST F:\RUCMP\POST\*.OUT DEL F:\RUCMP\POST\*.OUT
IF EXIST F:\RUCMP\CMP\*.OUT DEL F:\RUCMP\CMP\*.OUT

ECHO RUTPRE rights user test setup > F:\RUCMP\RUN.LOG
ECHO Run this as SUPERVISOR. >> F:\RUCMP\RUN.LOG
ECHO. >> F:\RUCMP\RUN.LOG

REM Reset old files.
IF EXIST F:\RUTEST\RONLY\READ.TXT DEL F:\RUTEST\RONLY\READ.TXT
IF EXIST F:\RUTEST\RONLY\NEW.TXT DEL F:\RUTEST\RONLY\NEW.TXT
IF EXIST F:\RUTEST\CREATE\BASE.TXT DEL F:\RUTEST\CREATE\BASE.TXT
IF EXIST F:\RUTEST\CREATE\NEW.TXT DEL F:\RUTEST\CREATE\NEW.TXT
IF EXIST F:\RUTEST\WRITE\W.TXT DEL F:\RUTEST\WRITE\W.TXT
IF EXIST F:\RUTEST\ERASE\E.TXT DEL F:\RUTEST\ERASE\E.TXT
IF EXIST F:\RUTEST\SCAN\S.TXT DEL F:\RUTEST\SCAN\S.TXT
IF EXIST F:\RUTEST\ACCESS\A.TXT DEL F:\RUTEST\ACCESS\A.TXT
IF EXIST F:\RUTEST\ALL\ALL.TXT DEL F:\RUTEST\ALL\ALL.TXT
IF EXIST F:\RUTEST\ALL\NEW.TXT DEL F:\RUTEST\ALL\NEW.TXT
IF EXIST F:\RUTEST\ALL\ALL2.TXT DEL F:\RUTEST\ALL\ALL2.TXT
IF EXIST F:\RUTEST\MOD1\M.TXT DEL F:\RUTEST\MOD1\M.TXT
IF EXIST F:\RUTEST\MOD1\M2.TXT DEL F:\RUTEST\MOD1\M2.TXT
IF EXIST F:\RUTEST\MOD2\M.TXT DEL F:\RUTEST\MOD2\M.TXT
IF EXIST F:\RUTEST\MOD2\M2.TXT DEL F:\RUTEST\MOD2\M2.TXT
IF EXIST F:\RUTEST\MOD3\M.TXT DEL F:\RUTEST\MOD3\M.TXT
IF EXIST F:\RUTEST\MOD3\M2.TXT DEL F:\RUTEST\MOD3\M2.TXT
IF EXIST F:\RUTEST\MOD4\M.TXT DEL F:\RUTEST\MOD4\M2.TXT
IF EXIST F:\RUTEST\MOD4\M.TXT DEL F:\RUTEST\MOD4\M.TXT
IF EXIST F:\RUTEST\MOD4\M2.TXT DEL F:\RUTEST\MOD4\M2.TXT

ECHO READ ONLY FILE > F:\RUTEST\RONLY\READ.TXT
ECHO CREATE TEST BASE > F:\RUTEST\CREATE\BASE.TXT
ECHO WRITE TEST > F:\RUTEST\WRITE\W.TXT
ECHO ERASE TEST > F:\RUTEST\ERASE\E.TXT
ECHO SCAN TEST > F:\RUTEST\SCAN\S.TXT
ECHO ACCESS TEST > F:\RUTEST\ACCESS\A.TXT
ECHO ALL TEST > F:\RUTEST\ALL\ALL.TXT
ECHO MOD1 TEST > F:\RUTEST\MOD1\M.TXT
ECHO MOD2 TEST > F:\RUTEST\MOD2\M.TXT
ECHO MOD3 TEST > F:\RUTEST\MOD3\M.TXT
ECHO MOD4 TEST > F:\RUTEST\MOD4\M.TXT

NPUBLIC\FLAG F:\RUTEST\RONLY\READ.TXT N >> F:\RUCMP\RUN.LOG
NPUBLIC\FLAG F:\RUTEST\CREATE\BASE.TXT N >> F:\RUCMP\RUN.LOG
NPUBLIC\FLAG F:\RUTEST\WRITE\W.TXT N >> F:\RUCMP\RUN.LOG
NPUBLIC\FLAG F:\RUTEST\ERASE\E.TXT N >> F:\RUCMP\RUN.LOG
NPUBLIC\FLAG F:\RUTEST\SCAN\S.TXT N >> F:\RUCMP\RUN.LOG
NPUBLIC\FLAG F:\RUTEST\ACCESS\A.TXT N >> F:\RUCMP\RUN.LOG
NPUBLIC\FLAG F:\RUTEST\ALL\ALL.TXT N >> F:\RUCMP\RUN.LOG
NPUBLIC\FLAG F:\RUTEST\MOD1\M.TXT N >> F:\RUCMP\RUN.LOG
NPUBLIC\FLAG F:\RUTEST\MOD2\M.TXT N >> F:\RUCMP\RUN.LOG
NPUBLIC\FLAG F:\RUTEST\MOD3\M.TXT N >> F:\RUCMP\RUN.LOG
NPUBLIC\FLAG F:\RUTEST\MOD4\M.TXT N >> F:\RUCMP\RUN.LOG

REM Grant result-output rights, otherwise MARIO cannot create Uxx.OUT.
ECHO === GRANT RESULT DIR RIGHTS === >> F:\RUCMP\RUN.LOG
NPUBLIC\GRANT R W C E M F FOR F:\RUCMP TO USER MARIO >> F:\RUCMP\RUN.LOG
NPUBLIC\GRANT R W C E M F FOR F:\RUCMP\MARIO TO USER MARIO >> F:\RUCMP\RUN.LOG

REM Grant trustee rights to MARIO.
ECHO === GRANT TEST RIGHTS === >> F:\RUCMP\RUN.LOG
NPUBLIC\GRANT R F FOR F:\RUTEST\RONLY TO USER MARIO >> F:\RUCMP\RUN.LOG
NPUBLIC\GRANT R F C FOR F:\RUTEST\CREATE TO USER MARIO >> F:\RUCMP\RUN.LOG
NPUBLIC\GRANT R W F FOR F:\RUTEST\WRITE TO USER MARIO >> F:\RUCMP\RUN.LOG
NPUBLIC\GRANT R F E FOR F:\RUTEST\ERASE TO USER MARIO >> F:\RUCMP\RUN.LOG
NPUBLIC\GRANT F FOR F:\RUTEST\SCAN TO USER MARIO >> F:\RUCMP\RUN.LOG
NPUBLIC\GRANT R F A FOR F:\RUTEST\ACCESS TO USER MARIO >> F:\RUCMP\RUN.LOG
NPUBLIC\GRANT R W C E M F A FOR F:\RUTEST\ALL TO USER MARIO >> F:\RUCMP\RUN.LOG

REM Rename/modify matrix:
REM MOD1 = known failing baseline from previous run: R W M F
REM MOD2 = add C
REM MOD3 = add E
REM MOD4 = add C and E
NPUBLIC\GRANT R W M F FOR F:\RUTEST\MOD1 TO USER MARIO >> F:\RUCMP\RUN.LOG
NPUBLIC\GRANT R W C M F FOR F:\RUTEST\MOD2 TO USER MARIO >> F:\RUCMP\RUN.LOG
NPUBLIC\GRANT R W E M F FOR F:\RUTEST\MOD3 TO USER MARIO >> F:\RUCMP\RUN.LOG
NPUBLIC\GRANT R W C E M F FOR F:\RUTEST\MOD4 TO USER MARIO >> F:\RUCMP\RUN.LOG

ECHO === PRE READBACK === >> F:\RUCMP\RUN.LOG
NPUBLIC\RIGHTS F:\RUCMP\MARIO > F:\RUCMP\PRE\OUTDIR.OUT
NPUBLIC\RIGHTS F:\RUTEST\RONLY > F:\RUCMP\PRE\RONLY.OUT
NPUBLIC\RIGHTS F:\RUTEST\CREATE > F:\RUCMP\PRE\CREATE.OUT
NPUBLIC\RIGHTS F:\RUTEST\WRITE > F:\RUCMP\PRE\WRITE.OUT
NPUBLIC\RIGHTS F:\RUTEST\ERASE > F:\RUCMP\PRE\ERASE.OUT
NPUBLIC\RIGHTS F:\RUTEST\SCAN > F:\RUCMP\PRE\SCAN.OUT
NPUBLIC\RIGHTS F:\RUTEST\ACCESS > F:\RUCMP\PRE\ACCESS.OUT
NPUBLIC\RIGHTS F:\RUTEST\ALL > F:\RUCMP\PRE\ALL.OUT
NPUBLIC\RIGHTS F:\RUTEST\MOD1 > F:\RUCMP\PRE\MOD1.OUT
NPUBLIC\RIGHTS F:\RUTEST\MOD2 > F:\RUCMP\PRE\MOD2.OUT
NPUBLIC\RIGHTS F:\RUTEST\MOD3 > F:\RUCMP\PRE\MOD3.OUT
NPUBLIC\RIGHTS F:\RUTEST\MOD4 > F:\RUCMP\PRE\MOD4.OUT
NPUBLIC\NDIR F:\RUTEST > F:\RUCMP\PRE\ROOT.OUT
NPUBLIC\NDIR F:\RUTEST /RIGHTS > F:\RUCMP\PRE\ROOTRGHT.OUT

ECHO === RUTPRE fertig ===
ECHO Jetzt als MARIO einloggen und RUTMARIO ausfuehren.
