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]
    Returns True when the user has Operations authority and False otherwise. If the UserAdmin.generate_requests_only class attribute is set to True, concatenated Security Request XML bytes will be returned.

❌ Raises

  • SecurityRequestError
    Raises SecurityRequestError when the SAF Return Code of a Security Result is equal to 4.
  • DownstreamFatalError
    Raises DownstreamFatalError when the SAF Return Code of a Security Result is greater than 4.

πŸ’» 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 the UserAdmin.generate_requests_only class attribute is set to True.

❌ Raises

  • SecurityRequestError
    Raises SecurityRequestError when the SAF Return Code of a Security Result is equal to 4.
  • DownstreamFatalError
    Raises DownstreamFatalError when the SAF Return Code of a Security Result is greater than 4.
  • AlterOperationError
    Raises AlterOperationError 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 the UserAdmin.generate_requests_only class attribute is set to True.

❌ Raises

  • SecurityRequestError
    Raises SecurityRequestError when the SAF Return Code of a Security Result is equal to 4.
  • DownstreamFatalError
    Raises DownstreamFatalError when the SAF Return Code of a Security Result is greater than 4.
  • AlterOperationError
    Raises AlterOperationError 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
    }
  }
}