Class Authorizations

User Administration functions for accessing and modifying a userโ€™s Class Authorizations.

UserAdmin.get_class_authorizations()

def get_class_authorizations(self, userid: str) -> Union[List[str], bytes]:

๐Ÿ“„ Description

Get a userโ€™s Class Authorizations.

๐Ÿ“ฅ Parameters

  • userid
    The z/OS userid of the user whose Class Authorizations is being requested.

๐Ÿ“ค Returns

  • Union[List[str], bytes]
    Returns the userโ€™s Class Authorizations. 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.get_class_authorizations("squidwrd")
['facility', 'terminal', 'xfacilit']

UserAdmin.set_class_authorizations()

def set_class_authorizations(
    self, userid: str, class_authorizations: List[str]
) -> Union[dict, bytes]:

๐Ÿ“„ Description

Overwrite a userโ€™s existing Class Authorizations.

๐Ÿ“ฅ Parameters

  • userid
    The z/OS userid of the user whose Class Authorizations are being overwritten.

  • class_authorizations
    A list of one or more Class Authorizations that will become the userโ€™s new Class Authorizations.

๐Ÿ“ค 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.set_class_authorizations("squidwrd", ["facility", "terminal", "xfacilit"])
{'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   NOCLAUTH      (terminal xfacilit)'}]}, 'returnCode': 0, 'reasonCode': 0, 'runningUserid': 'testuser'}}, 'step2': {'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     CLAUTH      (facility terminal xfacilit)'}]}, '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   NOCLAUTH      (terminal xfacilit)"
          }
        ]
      },
      "returnCode": 0,
      "reasonCode": 0
    }
  },
  "step2": {
    "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     CLAUTH      (facility terminal xfacilit)"
          }
        ]
      },
      "returnCode": 0,
      "reasonCode": 0
    }
  }
}

UserAdmin.add_class_authorizations()

def add_class_authorizations(
    self, userid: str, class_authorizations: Union[str, List[str]]
) -> Union[dict, bytes]:

๐Ÿ“„ Description

Add new Class Authorizations to a userโ€™s existing Class Authorizations.

๐Ÿ“ฅ Parameters

  • userid
    The z/OS userid of the user to add Class Authorizations to.

  • class_authorizations

    May be a string value or a list of string values.


    One or more Class Authorazitons to add.

๐Ÿ“ค 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.add_class_authorizations("squidwrd", ["terminal", "xfacilit"])
{'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     CLAUTH      (terminal xfacilit)'}]}, '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     CLAUTH      (terminal xfacilit)"
          }
        ]
      },
      "returnCode": 0,
      "reasonCode": 0
    }
  }
}

UserAdmin.remove_class_authorizations()

def remove_class_authorizations(
    self, userid: str, class_authorizations: Union[str, List[str]]
) -> Union[dict, bytes]:

๐Ÿ“„ Description

Remove Class Authorizations to a userโ€™s existing Class Authorizations.

๐Ÿ“ฅ Parameters

  • userid
    The z/OS userid of the user to remove Class Authorizations from.

  • class_authorizations

    May be a string value or a list of string values.


    One or more Class Authorazitons to remove.

๐Ÿ“ค 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.remove_class_authorizations("squidwrd", ["facility", "terminal"])
{'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   NOCLAUTH      (facility terminal)'}]}, '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   NOCLAUTH      (facility terminal)"
          }
        ]
      },
      "returnCode": 0,
      "reasonCode": 0
    }
  }
}

UserAdmin.remove_all_class_authorizations()

def remove_all_class_authorizations(self, userid: str) -> Union[dict, bool, bytes]:

๐Ÿ“„ Description

Delete all of a userโ€™s Class Authorizations.

๐Ÿ“ฅ Parameters

  • userid
    The z/OS userid of the user whose class authorizations will be deleted.

๐Ÿ“ค Returns

  • Union[dict, bool, bytes]
    Returns a Security Result Steps dictionary, Concatenated Security Request XML bytes if the UserAdmin.generate_requests_only class attribute is True, or False if the user has no Class Authorizations to delete.

โŒ 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.delete_all_class_authorizations("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   NOCLAUTH      (facility terminal xfacilit)'}]}, '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   NOCLAUTH      (facility terminal xfacilit)"
          }
        ]
      },
      "returnCode": 0,
      "reasonCode": 0
    }
  }
}