(go to: table of contents, index, list of pyvms, prev: HISTORY_SHOW)
pyvms.uaf_get_usernames() does _not_ raise an exception when one of the
system services (SYS$OPEN, SYS$CONNECT, SYS$GET, SYS$CLOSE) returns an error.
The routine stores two additional keys in the dictionary that is returned to
the user.
Warning! This routine requires file access to SYSUAF.DAT. The Python executable
should NOT be installed with privileges to provide this access. The interpreter
and its VMS extensions have NO safeguards build in to limit privilege usage to
this routine!
Note: the system services SYS$GETUAI and
SYS$SETUAI provide a 'context' argument,
but it can only be used for repeated access to the SAME username.
Format:
None
Examples:
UAF_GET_USERNAMES - Get list of usernames from authorization file
Returns a list of all usernames that exist in SYSUAF.DAT
13-MAY-1999 ZE.
dict = pyvms.uaf_get_usernames ()
Returns:
Arguments:
>>> import pyvms
>>> dict = pyvms.uaf_get_usernames ()
>>> type (dict)
<type 'dictionary'>
>>> dict
{'sts': 98938, 'stv': 0, 'usernames': ['DECNET', 'DEFAULT',
'FAL$SERVER', 'FIELD', 'GETUAI_TST', 'HTTP_SERVER', 'MAIL$SERVER',
'MIRRO$SERVER', 'NML$SERVER', 'NOPRIV', 'PHONE$SERVER', 'RAYTRACE',
'SETUAI_TST', 'SYSTEM', 'SYSTEST', 'SYSTEST_CLIG', 'SYS_ARCHIVE',
'SYS_BACKUP', 'SYS_CRON', 'SYS_MONITOR', 'UCX$BIND', 'UCX$FTP',
'UCX$PORTM', 'UUCP_DAEMON', 'UUCP_LOGIN', 'UUCP_TEST', 'VPM$SERVER',
'ZESSIN']}
>>> sts = dict.get('sts')
>>> import vms_sys
>>> print vms_sys.getmsg (sts)
('%RMS-E-EOF, end of file detected', (0, 0, 0, 0))
>>>
>>> # loop over list and list usernames with owner
>>> usernames = dict.get('usernames')
>>> for username in usernames:
... dict = vms_sys.getuai (None,None,username, \
... ('UAI$_OWNER', 'UAI$_EXPIRATION'))
... owner = dict.get ('UAI$_OWNER')
... print "%12s, %s" % (username, owner)
...
DECNET, DECNET DEFAULT
DEFAULT, DEFAULT
FAL$SERVER, FAL$SERVER DEFAULT
FIELD, FIELD SERVICE
GETUAI_TST, PYVMS-getuai-TEST
HTTP_SERVER, WWW-Server
MAIL$SERVER, MAIL$SERVER DEFAULT
MIRRO$SERVER, MIRRO$SERVER DEFAULT
NML$SERVER, NML$SERVER DEFAULT
NOPRIV, Zessin,Uwe
PHONE$SERVER, PHONE$SERVER DEFAULT
RAYTRACE, Zessin,Uwe
SETUAI_TST, SU_NEW_OWNER
SYSTEM, SYSTEM MANAGER
SYSTEST, SYSTEST-UETP
SYSTEST_CLIG, SYSTEST-UETP
SYS_ARCHIVE, SYSTEM ARCHIVE
SYS_BACKUP, SYSTEM BACKUP
SYS_CRON, CRON scheduler
SYS_MONITOR, SYSTEM MONITOR
UCX$BIND, UCX$BIND
UCX$FTP, UCX$FTP
UCX$PORTM, UCX$PORTM
UUCP_DAEMON, UUCP daemon account
UUCP_LOGIN, Template UUCP Account
UUCP_TEST, UUCP Test Account
VPM$SERVER, VPM$SERVER DEFAULT
ZESSIN, Zessin,Uwe
>>>
------------------------------
>>> dict = pyvms.uaf_get_usernames ('BAD-ARG')
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: function requires exactly 0 arguments; 1 given
>>>
>>> # no privilege to access SYSUAF.DAT
>>> dict = pyvms.uaf_get_usernames ()
>>> dict
{'sts': 98970, 'stv': 36}
>>> sts = dict.get('sts')
>>> print vms_sys.getmsg (sts)
('%RMS-E-PRV, insufficient privilege or file protection violation',\
(0, 0, 0, 0))
>>> stv = dict.get('stv')
>>> print vms_sys.getmsg (stv)
('%SYSTEM-F-NOPRIV, insufficient privilege or object protection\
violation', (0, 0, 0, 0))
>>>
$ define SYSUAF XX
>>> import vms_sys
>>> dict = pyvms.uaf_get_usernames ()
>>> dict
{'sts': 98962, 'stv': 2320}
>>> sts = dict.get('sts')
>>> print vms_sys.getmsg (sts)
('%RMS-E-FNF, file not found', (0, 0, 0, 0))
>>> stv = dict.get('stv')
>>> print vms_sys.getmsg (stv)
('%SYSTEM-W-NOSUCHFILE, no such file', (0, 0, 0, 0))
>>>
$ define sysuaf no_disk:[000000]SYSUAF.DAT
>>> dict = pyvms.uaf_get_usernames ()
>>> dict
{'sts': 99524, 'stv': 324}
>>> sts = dict.get('sts')
>>> print vms_sys.getmsg (sts)
('%RMS-F-DEV, error in device name or inappropriate device type\
for operation', (0, 0, 0, 0))
>>> stv = dict.get('stv')
>>> print vms_sys.getmsg (stv)
('%SYSTEM-F-IVDEVNAM, invalid device name', (0, 0, 0, 0))
>>>
(go to: table of contents,
index,
list of pyvms,
prev: HISTORY_SHOW)