Skip to main content

Want to prohibit users from using the DELETE Verb from tcl or the Command prompt, but want to be able to use DELETE from Unibasic
if there a way that i can tell where the command is being executed from
Using Unidata system



------------------------------
robert modrich
Developer
Rocket Forum Shared Account
TEMECULA CA US
------------------------------

Want to prohibit users from using the DELETE Verb from tcl or the Command prompt, but want to be able to use DELETE from Unibasic
if there a way that i can tell where the command is being executed from
Using Unidata system



------------------------------
robert modrich
Developer
Rocket Forum Shared Account
TEMECULA CA US
------------------------------

Change the DELETE item in VOC to a new name, like DELETE.HIDE.
Create a VOC item named DELETE, but it is a paragraph that calls a UniBasic program.
Inside the UniBasic program, validate as necessary, such as checking @LEVEL.  You can add tracking/logging as you desire.  If the delete is allowed, EXECUTE/PERFORM the renamed DELETE item in the VOC (e.g. DELETE.HIDE) using the file and item information from @PARASENTENCE.   Be certain to account for active select lists.



------------------------------
Dean Armbruster
Developer V
Ferguson Enterprises
VA [Country}
------------------------------

Change the DELETE item in VOC to a new name, like DELETE.HIDE.
Create a VOC item named DELETE, but it is a paragraph that calls a UniBasic program.
Inside the UniBasic program, validate as necessary, such as checking @LEVEL.  You can add tracking/logging as you desire.  If the delete is allowed, EXECUTE/PERFORM the renamed DELETE item in the VOC (e.g. DELETE.HIDE) using the file and item information from @PARASENTENCE.   Be certain to account for active select lists.



------------------------------
Dean Armbruster
Developer V
Ferguson Enterprises
VA [Country}
------------------------------

Dean thanks for that information
 Have never used @LEVEL where can I find more information about it
in the Unibasic documentation all it says is - "Current PERFORM or EXECUTE level"



------------------------------
robert modrich
Developer
Rocket Forum Shared Account
TEMECULA CA US
------------------------------

Want to prohibit users from using the DELETE Verb from tcl or the Command prompt, but want to be able to use DELETE from Unibasic
if there a way that i can tell where the command is being executed from
Using Unidata system



------------------------------
robert modrich
Developer
Rocket Forum Shared Account
TEMECULA CA US
------------------------------

Robert,

Here is my worked example showing the difference on testing @LEVEL to allow / disallow an EXECUTE / PEFORM DELETE in UniBasic.

Write a subroutine called DELETESEC as below

SUBROUTINE DELETESEC(OKAY)
OKAY = 0
RETURN
END

Compile and Catalog

Copy the DELETE verb from the VOC to your alternative VOC (in my case SECVOC)

Case 1 from ECL (Note DELETE is not a verb)

:DELETE VOC XX
Not a verb
 DELETE
:

Case 2 from Basic using the following program (Note XX gets deleted via the Basic DELETE command)
AE BP DEL.XX
Top of "DEL.XX" in "BP", 9 lines, 157 characters.
*--: p
001: OPEN "VOC" TO F.VOC ELSE STOP
002: WRITE "XX" TO F.VOC,"XX"
003: DELETE F.VOC,"XX"
004: READ DUMMY FROM F.VOC,"XX" THEN
005:   CRT "ON FILE"
006: END ELSE
007:   CRT "NOT ON FILE"
008: END
009: END
Bottom.
*--: fibr
Filed "DEL.XX" in file "BP" unchanged.

Compiling Unibasic: BP\\DEL.XX in mode 'u'.
compilation finished
NOT ON FILE
:

Case 3 EXECUTE / PERFORM from Basic (Not the EXECUTE of DELETE is blocked)
AE BP DEL.XX.2
Top of "DEL.XX.2" in "BP", 2 lines, 27 characters.
*--: P
001: OPEN "VOC" TO F.VOC ELSE STOP
002: WRITE "XX" TO F.VOC,"XX"
003: EXECUTE 'DELETE VOC XX'
004: END
Bottom.
*--: FIBR
Filed "DEL.XX.2" in file "BP" unchanged.

Compiling Unibasic: BP\\DEL.XX.2 in mode 'u'.
compilation finished
In BP\\_DEL.XX.2 at line 3 Not a verb
In BP\\_DEL.XX.2 at line 3  DELETE
:

Now if you wish allow the EXECUTE 'DELETE' change the program DELETESEC to read
@LEVEL contains the number of EXECUTE / PERFORM levels you have gone down.
The initial level is 0.

SUBROUTINE DELETESEC(OKAY)
IF @LEVEL NE 0 THEN OKAY = 1 ELSE OKAY = 0
RETURN
END

Compile and recatalog as required

From ECL (Note still blocked from ECL)

:DELETE VOC XX 
Not a verb
 DELETE
:

Use First Program (DELETE command from UniBasic works)
:RUN BP DEL.XX
NOT ON FILE
:

Use Second Program Now (The EXECUTE DELETE is allowed)
:RUN BP DEL.XX.2
'XX' deleted.


If you where to test @SENTENCE in DELETESEC when using DEL.XX.2 it would contain 'DELETE VOC XX' 
@PARASENTENCE would be set if coming from a paragraph.


Hope this explains it all



------------------------------
Jonathan Smith
UniData ATS
Rocket Support
------------------------------


Dean thanks for that information
 Have never used @LEVEL where can I find more information about it
in the Unibasic documentation all it says is - "Current PERFORM or EXECUTE level"



------------------------------
robert modrich
Developer
Rocket Forum Shared Account
TEMECULA CA US
------------------------------

Jonathan thanks for that additional information
so if someone tries to uses delete from the command prompt then @level will equal 0
and if a basic program executes delete then @level will equal 1




------------------------------
robert modrich
Developer
Rocket Forum Shared Account
TEMECULA CA US
------------------------------