Alter
Alter an existing z/OS userid.
UserAdmin.alter()
def alter(self, userid: str, traits: dict) -> Union[dict, bytes]:
📄 Description
Only a subset of available Segments and Traits are considered Stable. See Segments and Traits for more details.
Alter operations in pyracf require READ access to
IRR.IRRSMO00.PRECHECK
in theXFACILIT
class This function will not produce output unless the user running the command has this access.
- pyRACF encodes the data it passes to RACF in Code Page
IBM-1047
.- If you are entering a password or phrase with special or national characters, users logging on from terminals using differnt or international codepages may experience errors.
- Please consult a list of invariant characters to use for such passwords or phrases if this applies to you.
Alter an existing z/OS userid.
📥 Parameters
-
userid
The z/OS userid being altered. -
traits
A dictionary of traits/attributes that should be altered. See Traits to see what all of the valid User Traits are.
📤 Returns
Union[dict, bytes]
Returns a Security Result dictionary or Security Request XML bytes if theUserAdmin.generate_requests_only
class attribute is set toTrue
.
❌ Raises
SecurityRequestError
RaisesSecurityRequestError
when the SAF Return Code of a Security Result is equal to4
.DownstreamFatalError
RaisesDownstreamFatalError
when the SAF Return Code of a Security Result is greater than4
.AlterOperationError
RaisesAlterOperationError
when the z/OS userid supplied cannot be altered because it does NOT exist.SegmentTraitError
RaisesSegmentTraitError
when the dictionary of traits/attributes provided contains one or more unknown traits.
💻 Example
The following example alters a user with a userid of squidwrd
and traits/attributes to alter are specified in the traits
dictionary.
Python Script
from pyracf import UserAdmin
user_admin = UserAdmin()
traits = {
"base:special": False,
"base:operations": True,
"omvs:home_directory": "/u/clarinet",
"omvs:default_shell": False,
}
user_admin.alter("squidwrd", traits=traits)
Security Result Dictionary as JSON
{
"securityResult": {
"user": {
"name": "SQUIDWRD",
"operation": "set",
"requestId": "UserRequest",
"info": [
"Definition exists. Add command skipped due to precheck option"
],
"commands": [
{
"safReturnCode": 0,
"returnCode": 0,
"reasonCode": 0,
"image": "ALTUSER SQUIDWRD NOSPECIAL OPERATIONS OMVS (HOME ('/u/clarinet') NOPROGRAM )"
}
]
},
"returnCode": 0,
"reasonCode": 0,
"runningUserid": "testuser"
}
}