Skip to main content
Participating Frequently
Mar 29, 2023 9:33 AM UTC

UNIDATA LOGTO VERB

In Unidata can you disable the LOGTO verb based upon a user login?



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

    6 replies

    Jonathan Smith
    Rocketeer
    Mar 29, 2023 9:46 AM UTC

    In Unidata can you disable the LOGTO verb based upon a user login?



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

    Robert,

    If you wish to restrict access to a verb there is a facility in UniData whereby you can use a Remote Item definintion in the VOC with security subroutine and is covered in the Using UniData Manual

    The section in the manual shows the following example

    Using remote items for security

    You can supply a security routine to be executed by the remote item. Remote items enable you to name a cataloged subroutine in attribute 4 which is executed when a user invokes the remote VOC record. The subroutine must have one argument, and return a value of 1 (true) or 0 (false). When a user invokes a remote item that executes a security subroutine, the remote item will not execute unless the subroutine returns 1 (true).


    The following screen shows an example of a remote item you could create for the ECL LIST command:


    :AE VOC LIST
    Top of "LIST" in "VOC", 4 lines, 26 characters.

    *--: P
    001: R
    002: OTHER_VOC
    003: LIST
    004: SECTEST2
    Bottom.
    *--:
    With this VOC record in place, when you execute the LIST command, UniData executes a security subroutine called SECTEST2. If that subroutine returns a value of 1, UniData executes the record LIST in a file called OTHER_VOC.


    The next screen shows the security subroutine:
    :AE BP SECTEST2
    Top of "SECTEST2" in "BP", 4 lines, 66 characters.
    *--: P
    001: SUBROUTINE SECTEST2(OKAY)
    002: COMMON /SECUR/ VALID
    003: OKAY = VALID
    004: RETURN
    Bottom.
    *--:

    In the following example, the subroutine obtains the value of VALID from named COMMON. The value can be set by another subroutine or program. The following screen shows what happens if VALID is 0 (false) and a user executes the ECL LIST  command:

    :CATALOG BP SECTEST2
    :LIST VOC WITH F1 = 'PA'
    Not a verb
    LIST
    :

    The next screen shows what happens if VALID is 1 (true):
    :LIST VOC WITH F1 = 'PA'
    LIST VOC WITH F1 = 'PA' 17:55:22 Dec 06 2011 1
    VOC.......
    ECLTYPE
    CP
    CT
    SP.OPEN
    listdict
    LISTDICT

    Regards,



    ------------------------------
    Jonathan Smith
    UniData ATS
    Rocket Support
    ------------------------------
    Rocket Software - Senior Principal Technical Support Engineer - UniData ATS
    Participating Frequently
    Mar 30, 2023 10:15 AM UTC

    Robert,

    If you wish to restrict access to a verb there is a facility in UniData whereby you can use a Remote Item definintion in the VOC with security subroutine and is covered in the Using UniData Manual

    The section in the manual shows the following example

    Using remote items for security

    You can supply a security routine to be executed by the remote item. Remote items enable you to name a cataloged subroutine in attribute 4 which is executed when a user invokes the remote VOC record. The subroutine must have one argument, and return a value of 1 (true) or 0 (false). When a user invokes a remote item that executes a security subroutine, the remote item will not execute unless the subroutine returns 1 (true).


    The following screen shows an example of a remote item you could create for the ECL LIST command:


    :AE VOC LIST
    Top of "LIST" in "VOC", 4 lines, 26 characters.

    *--: P
    001: R
    002: OTHER_VOC
    003: LIST
    004: SECTEST2
    Bottom.
    *--:
    With this VOC record in place, when you execute the LIST command, UniData executes a security subroutine called SECTEST2. If that subroutine returns a value of 1, UniData executes the record LIST in a file called OTHER_VOC.


    The next screen shows the security subroutine:
    :AE BP SECTEST2
    Top of "SECTEST2" in "BP", 4 lines, 66 characters.
    *--: P
    001: SUBROUTINE SECTEST2(OKAY)
    002: COMMON /SECUR/ VALID
    003: OKAY = VALID
    004: RETURN
    Bottom.
    *--:

    In the following example, the subroutine obtains the value of VALID from named COMMON. The value can be set by another subroutine or program. The following screen shows what happens if VALID is 0 (false) and a user executes the ECL LIST  command:

    :CATALOG BP SECTEST2
    :LIST VOC WITH F1 = 'PA'
    Not a verb
    LIST
    :

    The next screen shows what happens if VALID is 1 (true):
    :LIST VOC WITH F1 = 'PA'
    LIST VOC WITH F1 = 'PA' 17:55:22 Dec 06 2011 1
    VOC.......
    ECLTYPE
    CP
    CT
    SP.OPEN
    listdict
    LISTDICT

    Regards,



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

    Jonathan that looks like it will solve my issue thanks for that thorough explanation



    ------------------------------
    robert modrich
    Developer
    Rocket Forum Shared Account
    TEMECULA CA US
    ------------------------------
    Participating Frequently
    Mar 30, 2023 12:23 PM UTC

    Jonathan that looks like it will solve my issue thanks for that thorough explanation



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

    Jonathan  I have been unable to get that to work

    1) i tried setting ecltype to U because we have it set to a P - did not work

    2) could you please provide me syntax that would allow me to do that for the LOGTO verb

    ED MD LOGTO
    Top of "LOGTO" in "MD", 4 lines, 14 characters.
    001: R
    002:
    003: LOGTO

    Thanks



    ------------------------------
    robert modrich
    Developer
    Rocket Forum Shared Account
    TEMECULA CA US
    ------------------------------
    Participating Frequently
    Mar 30, 2023 12:25 PM UTC

    Jonathan  I have been unable to get that to work

    1) i tried setting ecltype to U because we have it set to a P - did not work

    2) could you please provide me syntax that would allow me to do that for the LOGTO verb

    ED MD LOGTO
    Top of "LOGTO" in "MD", 4 lines, 14 characters.
    001: R
    002:
    003: LOGTO

    Thanks



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

    ED MD LOGTOED MD LOGTO
    Top of "LOGTO" in "MD", 4 lines, 14 characters.
    001: R
    002:
    003: LOGTO
    004: VPROGRAM



    ------------------------------
    robert modrich
    Developer
    Rocket Forum Shared Account
    TEMECULA CA US
    ------------------------------
    Jonathan Smith
    Rocketeer
    Mar 30, 2023 1:02 PM UTC

    ED MD LOGTOED MD LOGTO
    Top of "LOGTO" in "MD", 4 lines, 14 characters.
    001: R
    002:
    003: LOGTO
    004: VPROGRAM



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

    Robert,

    In your example attribute 2 is blank, it needs to contain the file where the true verb can be found.

    Here is a worked example for you from my own machine.

    Step 1 - Create a new simple subroutine, compile and catalog I choose a direct catalog

    :AE BP LOGTOSEC
    Top of New "LOGTOSEC" in "BP".
    *--: I
    001= SUBROUTINE LOGTOSEC(OKAY)
    002= OKAY = 1
    003= RETURN
    004= END
    *--: FIB
    Filed "LOGTOSEC" in file "BP".

    Compiling Unibasic: BP\\LOGTOSEC in mode 'u'.
    compilation finished


    :CATALOG BP LOGTOSEC DIRECT

    Step 2 - Create a file to store the original verb(s)  in

    :CREATE.FILE SECVOC 3
    Create file D_SECVOC, modulo/1,blocksize/1024
    Hash type = 0
    Create file SECVOC, modulo/3,blocksize/1024
    Hash type = 3
    Added "@ID", the default record for UniData to DICT SECVOC.

    Step 3 - I copied the original Verb for LOGTO to the SECVOC file.


    :AE SECVOC LOGTO
    Top of New "LOGTO" in "SECVOC".
    *--: LOAD VOC LOGTO
    'Q'uit, or starting line > 1, ending line > 2
    At line 2, 2 lines loaded.
    *--: FI
    Filed "LOGTO" in file "SECVOC".
    :CT SECVOC LOGTO
    SECVOC:

    LOGTO:
    V
    LOGTO

    Step 4 - Modify the original LOGTO verb in the VOC

    attribute 1  = R

    attribute 2 = The name of the file where the verb was copied to

    attribute 3 = The name of the verb in the file defined in attribute 2

    attribute 4 = The security subroutine to run

    :AE VOC LOGTO
    Top of "LOGTO" in "VOC", 4 lines, 23 characters.
    *--: P
    001: R
    002: SECVOC
    003: LOGTO
    004: LOGTOSEC
    Bottom.
    *--:

    Step 5 With OKAY set to 1 in the security program, LOGTO works
    :LOGTO DEMO

    Step 6 Go back to the original account and now change OKAY to 0 in the program

    I only had to recompile as I had a direct catalog

    :AE BP LOGTOSEC
    Top of "LOGTOSEC" in "BP", 4 lines, 45 characters.
    001: SUBROUTINE LOGTOSEC(OKAY)
    002: OKAY = 1
    002: OKAY = 0
    *--: FIB
    Filed "LOGTOSEC" in file "BP".

    Compiling Unibasic: BP\\LOGTOSEC in mode 'u'.
    compilation finished

    Step 7 Now try LOGTO


    :LOGTO DEMO
    Not a verb
     LOGTO
    :



    ------------------------------
    Jonathan Smith
    UniData ATS
    Rocket Support
    ------------------------------
    Rocket Software - Senior Principal Technical Support Engineer - UniData ATS
    Participating Frequently
    Mar 30, 2023 3:15 PM UTC

    Robert,

    In your example attribute 2 is blank, it needs to contain the file where the true verb can be found.

    Here is a worked example for you from my own machine.

    Step 1 - Create a new simple subroutine, compile and catalog I choose a direct catalog

    :AE BP LOGTOSEC
    Top of New "LOGTOSEC" in "BP".
    *--: I
    001= SUBROUTINE LOGTOSEC(OKAY)
    002= OKAY = 1
    003= RETURN
    004= END
    *--: FIB
    Filed "LOGTOSEC" in file "BP".

    Compiling Unibasic: BP\\LOGTOSEC in mode 'u'.
    compilation finished


    :CATALOG BP LOGTOSEC DIRECT

    Step 2 - Create a file to store the original verb(s)  in

    :CREATE.FILE SECVOC 3
    Create file D_SECVOC, modulo/1,blocksize/1024
    Hash type = 0
    Create file SECVOC, modulo/3,blocksize/1024
    Hash type = 3
    Added "@ID", the default record for UniData to DICT SECVOC.

    Step 3 - I copied the original Verb for LOGTO to the SECVOC file.


    :AE SECVOC LOGTO
    Top of New "LOGTO" in "SECVOC".
    *--: LOAD VOC LOGTO
    'Q'uit, or starting line > 1, ending line > 2
    At line 2, 2 lines loaded.
    *--: FI
    Filed "LOGTO" in file "SECVOC".
    :CT SECVOC LOGTO
    SECVOC:

    LOGTO:
    V
    LOGTO

    Step 4 - Modify the original LOGTO verb in the VOC

    attribute 1  = R

    attribute 2 = The name of the file where the verb was copied to

    attribute 3 = The name of the verb in the file defined in attribute 2

    attribute 4 = The security subroutine to run

    :AE VOC LOGTO
    Top of "LOGTO" in "VOC", 4 lines, 23 characters.
    *--: P
    001: R
    002: SECVOC
    003: LOGTO
    004: LOGTOSEC
    Bottom.
    *--:

    Step 5 With OKAY set to 1 in the security program, LOGTO works
    :LOGTO DEMO

    Step 6 Go back to the original account and now change OKAY to 0 in the program

    I only had to recompile as I had a direct catalog

    :AE BP LOGTOSEC
    Top of "LOGTOSEC" in "BP", 4 lines, 45 characters.
    001: SUBROUTINE LOGTOSEC(OKAY)
    002: OKAY = 1
    002: OKAY = 0
    *--: FIB
    Filed "LOGTOSEC" in file "BP".

    Compiling Unibasic: BP\\LOGTOSEC in mode 'u'.
    compilation finished

    Step 7 Now try LOGTO


    :LOGTO DEMO
    Not a verb
     LOGTO
    :



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

    The piece I was missing was copying the current verb to a different file , makes sense and  got it working

    Jonathan  thanks again for your prompt follow up



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