Operations Authority
User Administration functions for accessing and modifying a userβs Operations Authority.
UserAdmin.has_operations_authority()
def has_operations_authority(self, userid: str) -> Union[bool, bytes]:
π Description
Check if a user has Operations authority.
π₯ Parameters
userid
The z/OS userid of the user whose authority is being checked.
π€ Returns
Union[bool, bytes]
ReturnsTrue
when the user has Operations authority andFalse
otherwise. If theUserAdmin.generate_requests_only
class attribute is set toTrue
, concatenated Security Request XML bytes will be returned.
β 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
.
π» Example
Python REPL
>>> from pyracf import UserAdmin
>>> user_admin = UserAdmin()
>>> user_admin.has_operations_authority("squidwrd")
False
UserAdmin.give_operations_authority()
def give_operations_authority(self, userid: str) -> Union[dict, bytes]:
π Description
Give a user Operations authority.
π₯ Parameters
userid
The z/OS userid of the user to give Operations authority.
π€ Returns
Union[dict, bytes]
Returns a Security Result Steps dictionary or Concatenated 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.
π» Example
Python REPL
>>> from pyracf import UserAdmin
>>> user_admin = UserAdmin()
>>> user_admin.give_operations_authority("squidwrd")
{'step1': {'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 OPERATIONS '}]}, 'returnCode': 0, 'reasonCode': 0, 'runningUserid': 'testuser'}}}
Security Result Steps Dictionary as JSON
{
"step1": {
"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 OPERATIONS "
}
]
},
"returnCode": 0,
"reasonCode": 0
}
}
}
UserAdmin.take_away_operations_authority()
def take_away_operations_authority(self, userid: str) -> Union[dict, bytes]:
π Description
Remove a userβs Operations authority.
π₯ Parameters
userid
The z/OS userid of the user to take Operator authority away from.
π€ Returns
Union[dict, bytes]
Returns a Security Result Steps dictionary or Concatenated 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.
π» Example
Python REPL
>>> from pyracf import UserAdmin
>>> user_admin = UserAdmin()
>>> user_admin.take_away_operations_authority("squidwrd")
{'step1': {'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 NOOPERATIONS '}]}, 'returnCode': 0, 'reasonCode': 0, 'runningUserid': 'testuser'}}}
Security Result Steps Dictionary as JSON
{
"step1": {
"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 NOOPERATIONS "
}
]
},
"returnCode": 0,
"reasonCode": 0
}
}
}