function void UpdateUser( Object prgCtx, Record r )
Assoc loginInfo
Assoc result
Assoc exAttrs
Assoc expireDateAssoc
Date pwdExpireDate
Integer privs
Record userRec
Dynamic password
Boolean allowPwdExpire
Boolean ok = TRUE
Object uapiCtx = prgCtx.USession()
// set local password field (if password is specified)
if r.set_password
password = r.password
end
if r.neverexpire_pw
allowPwdExpire = false
else
allowPwdExpire = true
end
// Make sure the password fields match.
if r.set_password && ( r.password != r.verify_password )
.fError = [Web_ErrMsg2.PasswordsDontMatch]
// Assemble the extended attributes.
elseif !.CheckExAttributes( r, exAttrs )
// Update the user. This should take care of extended attribute data,
// login name change, and privilege changes.
else
pwdExpireDate = r.PasswordExpire
if ( IsDefined( pwdExpireDate ) )
// Wack any time portion and subtract 1 second -- this means the password will be expired
// on the first second of the given day.
pwdExpireDate = pwdExpireDate - Date.TimeInteger( pwdExpireDate ) - 1
end
expireDateAssoc.Date = pwdExpireDate
result = $LLIApi.UsersPkg.UserUpdate(\
uapiCtx,\
r.userID,\
r.loginName,\
UNDEFINED,\
$LLIApi.UsersPkg.PrivsAssocToMask( r ),\
exAttrs,\
UNDEFINED,\
password,\
this, \
UNDEFINED, \
expireDateAssoc, \
r.GroupID, \
allowPwdExpire )
// check for errors
if .CheckError( result )
if ( !$Kernel.SystemPreferences.GetPrefBoolean( "general", "encodeCookies", true ) )
// Adjust the cookie if the modified user is the current user.
if ( ( uapiCtx.fUserID == r.userID ) && ( r.set_password ) )
.fExtraHeaders = .SetLLCookie( password )
end
end
end
end
end