(LOGO.JPG) Python for OpenVMS

(go to: table of contents, index, list of vms_sys, prev: FORCEX, next: GETJPIW)


FORMAT_ACL - Format Access Control List Entry


Formats the specified access control entry (ACE) into a text string. Note the difference between an 'access control list' (ACL) and an ACE - an ACL is comprised by one or more ACEs.

Format:

    status, aclstr = vms_sys.format_acl
            (aclent ,[width] ,[trmdsc] ,[indent] ,[accnam] ,[nullarg])

Returns:
status
Condition value from SYS$FORMAT_ACL. Can be SS$_NORMAL or SS$_BUFFEROVF. All other codes raise a Python exception.
aclstr
Formatted ACE resulting when SYS$FORMAT_ACL completes its execution. The 'acllen' argument from SYS$FORMAT_ACL is not returned - use the len() function from Python.
Arguments:
aclent
Input ACE, binary. See the system services reference manual for an explanation of how it is formatted,
width
Maximum width of the formatted ACE.
trmdsc
Line termination characters used in the formatted ACE. It is used when the total length exceeds the size of the 'width' argument.
indent
Number of blank characters beginning each line of the formatted ACE.
accnam
Names of the bits in the access mask. Specify 'None' to indicate omission of this argument or a 'vmsobj__access_names' object.
nullarg
Placeholder argument - any input other than None is an error.
Examples:
$ copy _NLA0: ACL.DAT
$ set ACL ACL.DAT -
      /ACL= ( (identifier= [1,4], access= read+write), -
              (identifier= [2,4], access= delete+execute), -
              (identifier= [3,4], access= control)          )
$!
$ directory /acl ACL.DAT

Directory DKA100:[PYTHON.PYTHON-1_5_2.VMS]

ACL.DAT;1
          (IDENTIFIER=[G1,SYSTEM],ACCESS=READ+WRITE)
          (IDENTIFIER=[2,4],ACCESS=EXECUTE+DELETE)
          (IDENTIFIER=[3,4],ACCESS=CONTROL)

Total of 1 file.
$!

----------------------------------------

>>> import pyvms, vms_sys
>>>
>>> fab    = pyvms.vmsobj_fab ()
>>> xabpro = pyvms.vmsobj_xabpro ()
>>>
>>> fab.FNA = 'ACL.DAT'
>>> fab.XAB = xabpro
>>>
>>> # allocate a read/write buffer for the ACL
>>> aclbuf = pyvms.vmsobj__membuf (200)
>>> xabpro.ACLBUF   = aclbuf
>>> xabpro.L_ACLCTX = 0       # read begin of ACL
>>>
>>> status = vms_sys.open (fab)
>>> print vms_sys.getmsg (status)
('%RMS-S-NORMAL, normal successful completion', (0, 0, 0, 0))
>>> print vms_sys.getmsg (fab.L_STS)
('%RMS-S-NORMAL, normal successful completion', (0, 0, 0, 0))
>>> # ACL status
>>> print vms_sys.getmsg (xabpro.L_ACLSTS)
('%SYSTEM-S-NORMAL, normal successful completion', (0, 0, 0, 0))
>>>
>>> # 1st ACE
>>> print vms_sys.format_acl (aclbuf.buffer[0:xabpro.W_ACLLEN], \
...                           90, '*', 4)
(1, '    (IDENTIFIER=[G1,SYSTEM],ACCESS=READ+WRITE)')
>>> aclsiz = ord (aclbuf.buffer[:1])
>>>
>>> # 2nd  ACE
>>> vms_sys.format_acl \
...         (aclbuf.buffer[aclsiz:xabpro.W_ACLLEN-aclsiz], \
...          60, '*', 4)
(1, '    (IDENTIFIER=[2,4],ACCESS=EXECUTE+DELETE)')
>>>
>>> # 3rd ACE ignored
>>>
>>> status = vms_sys.close (fab)
>>> print vms_sys.getmsg (status)
('%RMS-S-NORMAL, normal successful completion', (0, 0, 0, 0))
>>>

@@ more vms_sys.format_acl() examples
>>>

(go to: table of contents, index, list of vms_sys, prev: FORCEX, next: GETJPIW)

11-JUL-1999 ZE.