(go to: table of contents, index, list of vms_sys, prev: SETSWM, next: SET_RESOURCE_DOMAIN)
vms_sys.setuai() does _not_ raise an exception when the SYS$SETUAI routine
returns an error. You must check 'status' in the dictionary that is returned.
Format:
After the call to SYS$SETUAI the modified value is returned in the 'dict'
object under the key 'contxt'. Feed this value into the 'contxt' argument
for the next call to vms_sys.setuai().
Note: the contxt argument is only usefull for repeated access to _the same_
username! SYS$SETUAI and (SYS$GETUAI) do not
provide any wildcard access over all usernames in the UAF.
The pyvms.uaf_get_usernames()
function can be used to get a list of all usernames that are stored in the UAF.
Format: (('UAI$_name', data), ('UAI$_name', data),...)
A 'counted ASCII string' (ASCIC) - which means that the first byte contains
the string length - is input as a normal string (one without the count byte
at the beginning). The Python interface constructs the length byte from
the current string length automatically.
Examples:
SETUAI - Set User Authorization Information
Modifies the user authorization file (UAF) record for a
specified user.
dict = vms_lib.setuai (None, [contxt], usrnam, itmlst \
[,None] [,None] [,None])
Returns:
Arguments:
special notes about some item codes:
Any input items that have been specified in the item-list and
that are supported by SYS$SETUAI.
Note that 'data' can itself be a tuple for some items - see below.
The documentation of OpenVMS V6.1 describes the data type as a longword
- this is wrong, a BYTE is required. (The requirement for
SYS$GETUAI as a longword is wrong, too).
UAF> add SETUAI_TST /owner= "PYVMS-setuai-TEST" -
/uic= [12345,13527] /account= "PYVMS_ST" -
/cli= "CLI_TEST" /clitables= "DCLTABLES_TEST" -
/lgicmd= "LGICMD_TEST" -
/flags= (dismail, disuser, restrict) -
/privileges= (noALL, TMPMBX) /defprivileges= (noALL, TMPMBX)
UAF> modify SETUAI_TST -
/device= "DEFDEV_TEST" /directory= [DEFDIRTEST]
UAF> modify SETUAI_TST -
/interactive /batch /network
UAF> modify SETUAI_TST /primedays= (noSATURDAY, noSUNDAY) -
/expiration= "29-FEB-2000 12:34:56.78" /pwdminimum= 12 -
/pwdlifetime= "12-21:43:56.87"
UAF> modify SETUAI_TST /maxjobs= 11 /maxacctjobs= 12 /prclm= 13 -
/priority= 14 /queprio= 15 /cputime= "11-22:33:44.55" -
/fillm= 111 /shrfillm= 112 /biolm= 113 /diolm= 114 -
/astlm= 115 /tqelm= 116 /enqlm= 117
UAF> modify SETUAI_TST /bytlm= 1111 /pbytlm= 1112 /jtquota= 1113 -
/wsdefault= 1114 /wsquota= 1115 /wsextent= 1116 -
/pgflquota= 1117 /password= XYZ
UAF> modify SETUAI_TST /local= -
(PRIMARY, 1-3,7,12-15, SECONDARY, 1-8,9,11,17-21,23)
------------------------------------------------------------
UAF> show SETUAI_TST
Username: SETUAI_TST Owner: PYVMS-setuai-TEST
Account: PYVMS_ST UIC: [12345,13527]
([PYVMS_GT,SETUAI_TST])
CLI: CLI_TEST Tables: DCLTABLES_TEST
Default: DEFDEV_TEST:[DEFDIRTEST]
LGICMD: LGICMD_TEST
Flags: DefCLI Restricted DisUser DisMail
Primary days: Mon Tue Wed Thu Fri
Secondary days: Sat Sun
Primary 000000000011111111112222 Secondary 000000000011111111112222
Day Hours 012345678901234567890123 Day Hours 012345678901234567890123
Network: ##### Full access ###### ##### Full access ######
Batch: ##### Full access ###### ##### Full access ######
Local: -###---#----####-------- -#########-#-----#####-#
Dialup: ##### Full access ###### ##### Full access ######
Remote: ##### Full access ###### ##### Full access ######
Expiration: 29-FEB-2000 12:34 Pwdminimum: 12 Login Fails: 0
Pwdlifetime: 12 21:43 Pwdchange: (pre-expired)
Last Login: (none) (interactive), (none)
(non-interactive)
Maxjobs: 11 Fillm: 111 Bytlm: 1111
Maxacctjobs: 12 Shrfillm: 112 Pbytlm: 1112
Maxdetach: 0 BIOlm: 113 JTquota: 1113
Prclm: 13 DIOlm: 114 WSdef: 1114
Prio: 14 ASTlm: 115 WSquo: 1115
Queprio: 15 TQElm: 116 WSextent: 1116
CPU: 11 22:33:44 Enqlm: 117 Pgflquo: 1117
Authorized Privileges:
TMPMBX
Default Privileges:
TMPMBX
UAF>
------------------------------------------------------------
>>> import vms_sys
>>> import vms_uaidef
>>> # UAI$_ACCOUNT = 8 characters + 24 trailing ' '
>>> t_account = 'SU_NEW '
>>> # 12345678901234567890123456789012
>>> # UAI$_CPUTIM is expressed in 10ms steps
>>> # SYS$BINTIM returns a granularity of 100ns steps
>>> q_cputim = vms_sys.bintim ('33 11:44:22.55')
>>> l_cputim = int(abs(q_cputim)/100000)
>>> import vms_prvdef
>>> q_def_priv = vms_prvdef.PRV_M_SYSNAM + \
... vms_prvdef.PRV_M_ALLSPOOL + \
... vms_prvdef.PRV_M_DETACH + \
... vms_prvdef.PRV_M_DIAGNOSE + \
... vms_prvdef.PRV_M_GROUP + \
... vms_prvdef.PRV_M_NOACNT + \
... vms_prvdef.PRV_M_PSWAPM #
>>>
>>> q_priv = vms_prvdef.PRV_M_CMEXEC + \
... vms_prvdef.PRV_M_GRPNAM + \
... vms_prvdef.PRV_M_ALLSPOOL + \
... vms_prvdef.PRV_M_GROUP + \
... vms_prvdef.PRV_M_PRMCEB + \
... vms_prvdef.PRV_M_SETPRI + \
... vms_prvdef.PRV_M_SETPRV + \
... vms_prvdef.PRV_M_TMPMBX #
>>>
>>> q_expdat = vms_sys.bintim ('28-FEB-1999 21:43:45.78')
>>> l_flags = vms_uaidef.UAI_M_CAPTIVE + \
... vms_uaidef.UAI_M_DISMAIL + \
... vms_uaidef.UAI_M_RESTRICTED
>>> # bits that are set indicate the secondary days!
>>> b_primedays = vms_uaidef.UAI_M_MONDAY + \
... vms_uaidef.UAI_M_TUESDAY + \
... vms_uaidef.UAI_M_FRIDAY
>>> q_pwd_date = vms_sys.bintim ('1-JAN-1998 01:01:01.01')
>>> q_pwd2_date = vms_sys.bintim ('2-JAN-1998 02:02:02.02')
>>> q_pwdlife = vms_sys.bintim ('9 19:29:39.49')
>>> # build new UIC from group and member
>>> w_grp = 015432 # 0nn is OCTAL notation
>>> w_mem = 017253
>>> l_uic = (w_grp * 65536) + w_mem
>>> dict = vms_sys.setuai (None,None,'SETUAI_TST',
... (('UAI$_ACCOUNT' ,t_account )
... ,('UAI$_ASTLM' ,315 )
... ,('UAI$_BIOLM' ,313 )
... ,('UAI$_BYTLM' ,3111 )
... ,('UAI$_CLITABLES' ,'SU_NEWCLITAB')
... ,('UAI$_CPUTIM' ,l_cputim )
... ,('UAI$_DEFCLI' ,'SU_NEWCLI' )
... ,('UAI$_DEFDEV' ,'SU_NEWDEV:' )
... ,('UAI$_DEFDIR' ,'[SU_NEWDIR' )
... ,('UAI$_DEF_PRIV' ,q_def_priv )
... ,('UAI$_DFWSCNT' ,3114 )
... ,('UAI$_DIOLM' ,314 )
... ,('UAI$_ENQLM' ,317 )
... ,('UAI$_EXPIRATION' ,q_expdat )
... ,('UAI$_FILLM' ,311 )
... ,('UAI$_FLAGS' ,l_flags )
... ,('UAI$_JTQUOTA' ,3113 )
... ,('UAI$_LGICMD' ,'SU_NEWLGICMD')
... ,('UAI$_LOGFAILS' ,77 )
... ,('UAI$_MAXACCTJOBS' ,32 )
... ,('UAI$_MAXDETACH' ,39 )
... ,('UAI$_MAXJOBS' ,31 )
... ,('UAI$_OWNER' ,'SU_NEW_OWNER')
... ,('UAI$_PBYTLM' ,3112 )
... ,('UAI$_PGFLQUOTA' ,3117 )
... ,('UAI$_PRCCNT' ,33 )
... ,('UAI$_PRI' ,31 )
... ,('UAI$_PRIMEDAYS' ,b_primedays )
... ,('UAI$_PRIV' ,q_priv )
... ,('UAI$_PWD_DATE' ,q_pwd_date )
... ,('UAI$_PWD2_DATE' ,q_pwd2_date )
... ,('UAI$_PWD_LENGTH' ,32 )
... ,('UAI$_PWD_LIFETIME' ,q_pwdlife )
... ,('UAI$_QUEPRI' ,35 )
... ,('UAI$_SALT' ,111 )
... ,('UAI$_SHRFILLM' ,312 )
... ,('UAI$_TQCNT' ,316 )
... ,('UAI$_UIC' ,l_uic )
... ,('UAI$_USER_DATA' ,'USER-DATA' )
... ,('UAI$_WSEXTENT' ,3116 )
... ,('UAI$_WSQUOTA' ,3115 )
... ))
>>> dict.get('status')
1
>>>
UAF> SHOW SETUAI_TST
Username: SETUAI_TST Owner: SU_NEW_OWNER
Account: SU_NEW UIC: [15432,17253]
([15432,17253])
CLI: SU_NEWCLI Tables: SU_NEWCLITAB
Default: SU_NEWDEV:[SU_NEWDIR
LGICMD: SU_NEWLGICMD
Flags: Restricted DisNewMail Captive
Primary days: Wed Thu Sat Sun
Secondary days: Mon Tue Fri
Primary 000000000011111111112222 Secondary 000000000011111111112222
Day Hours 012345678901234567890123 Day Hours 012345678901234567890123
Network: ##### Full access ###### ##### Full access ######
Batch: ##### Full access ###### ##### Full access ######
Local: -###---#----####-------- -#########-#-----#####-#
Dialup: ##### Full access ###### ##### Full access ######
Remote: ##### Full access ###### ##### Full access ######
Expiration: 28-FEB-1999 21:43 Pwdminimum: 32 Login Fails: 77
Pwdlifetime: 9 19:29 Pwdchange: 1-JAN-1998 01:01 2-JAN-1998 02:02
Last Login: (none) (interactive), (none) (non-interactive)
Maxjobs: 31 Fillm: 311 Bytlm: 3111
Maxacctjobs: 32 Shrfillm: 312 Pbytlm: 3112
Maxdetach: 39 BIOlm: 313 JTquota: 3113
Prclm: 33 DIOlm: 314 WSdef: 3114
Prio: 31 ASTlm: 315 WSquo: 3115
Queprio: 35 TQElm: 316 WSextent: 3116
CPU: 33 11:44:22 Enqlm: 317 Pgflquo: 3117
Authorized Privileges:
ALLSPOOL ALTPRI CMEXEC GROUP GRPNAM PRMCEB SETPRV TMPMBX
Default Privileges:
ACNT ALLSPOOL DETACH DIAGNOSE GROUP PSWAPM SYSNAM
----------------------------------------
Warning! Identifiers have not been changed!
UAF> SHOW/IDENTIFIER PYVMS_GT
Name Value Attributes
PYVMS_GT [012345,177777]
UAF> SHOW/IDENTIFIER SETUAI_TST
Name Value Attributes
SETUAI_TST [012345,013527]
UAF>
You need vms_sys.mod_ident() to do this.
----------------------------------------
The contents from UAI$_USER_DATA is not shown by AUTHORIZE:
>>> dict = vms_sys.getuai (None,None,'SETUAI_TST', \
... ('UAI$_USER_DATA',))
>>> # ^-- one-item tuple
>>> dict.get ('status')
1
>>> dict.get ('UAI$_USER_DATA')
'USER-DATA'
>>>
------------------------------------------------------------
>>> import vms_sys
>>> q_li_i = vms_sys.bintim ('1-MAR-1996 01:02:03.45')
>>> q_li_n = vms_sys.bintim ('2-APR-1997 10:20:30.54')
>>> dict = vms_sys.setuai (None,None,'SETUAI_TST',
... (('UAI$_LASTLOGIN_I', q_li_i)
... ,('UAI$_LASTLOGIN_N', q_li_n)
... ,('UAI$_BATCH_ACCESS_P', (85, 85, 85))
... ,('UAI$_BATCH_ACCESS_S', (170, 170, 170))
... ,('UAI$_DIALUP_ACCESS_P', (68, 68, 68))
... ,('UAI$_DIALUP_ACCESS_S', (136, 136, 136))
... ,('UAI$_LOCAL_ACCESS_P', (34, 34, 34))
... ,('UAI$_LOCAL_ACCESS_S', (153, 153, 153))
... ,('UAI$_NETWORK_ACCESS_P', (1, 1, 1))
... ,('UAI$_NETWORK_ACCESS_S', (8, 8, 8))
... ,('UAI$_REMOTE_ACCESS_P', (254, 254, 254))
... ,('UAI$_REMOTE_ACCESS_S', (128, 128, 128))
... ))
>>> dict.get('status')
1
>>>
UAF> SHOW SETUAI_TST
Username: SETUAI_TST Owner: SU_NEW_OWNER
Account: SU_NEW UIC: [15432,17253]
([15432,17253])
CLI: SU_NEWCLI Tables: SU_NEWCLITAB
Default: SU_NEWDEV:[SU_NEWDIR
LGICMD: SU_NEWLGICMD
Flags: Restricted DisNewMail Captive
Primary days: Wed Thu Sat Sun
Secondary days: Mon Tue Fri
Primary 000000000011111111112222 Secondary 000000000011111111112222
Day Hours 012345678901234567890123 Day Hours 012345678901234567890123
Network: -#######-#######-####### ###-#######-#######-####
Batch: -#-#-#-#-#-#-#-#-#-#-#-# #-#-#-#-#-#-#-#-#-#-#-#-
Local: #-###-###-###-###-###-## -##--##--##--##--##--##-
Dialup: ##-###-###-###-###-###-# ###-###-###-###-###-###-
Remote: #-------#-------#------- #######-#######-#######-
Expiration: 28-FEB-1999 21:43 Pwdminimum: 32 Login Fails: 77
Pwdlifetime: 9 19:29 Pwdchange: \
1-JAN-1998 01:01 2-JAN-1998 02:02
Last Login: 1-MAR-1996 01:02 (interactive), \
2-APR-1997 10:20 (non-interactive)
Maxjobs: 31 Fillm: 311 Bytlm: 3111
[...]
>>>
(go to: table of contents,
index,
list of vms_sys,
prev: SETSWM,
next: SET_RESOURCE_DOMAIN)