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_onlyclass attribute is set to- True, concatenated Security Request XML bytes will be returned.
โ Raises
- SecurityRequestError
 Raises- SecurityRequestErrorwhen the SAF Return Code of a Security Result is equal to- 4.
- DownstreamFatalError
 Raises- DownstreamFatalErrorwhen 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_onlyclass attribute is set to- True.
โ Raises
- SecurityRequestError
 Raises- SecurityRequestErrorwhen the SAF Return Code of a Security Result is equal to- 4.
- DownstreamFatalError
 Raises- DownstreamFatalErrorwhen the SAF Return Code of a Security Result is greater than- 4.
- AlterOperationError
 Raises- AlterOperationErrorwhen 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_onlyclass attribute is set to- True.
โ Raises
- SecurityRequestError
 Raises- SecurityRequestErrorwhen the SAF Return Code of a Security Result is equal to- 4.
- DownstreamFatalError
 Raises- DownstreamFatalErrorwhen the SAF Return Code of a Security Result is greater than- 4.
- AlterOperationError
 Raises- AlterOperationErrorwhen 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_onlyclass attribute is set to- True.
โ Raises
- SecurityRequestError
 Raises- SecurityRequestErrorwhen the SAF Return Code of a Security Result is equal to- 4.
- DownstreamFatalError
 Raises- DownstreamFatalErrorwhen the SAF Return Code of a Security Result is greater than- 4.
- AlterOperationError
 Raises- AlterOperationErrorwhen 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_onlyclass attribute is- True, or- Falseif the user has no Class Authorizations to delete.
โ Raises
- SecurityRequestError
 Raises- SecurityRequestErrorwhen the SAF Return Code of a Security Result is equal to- 4.
- DownstreamFatalError
 Raises- DownstreamFatalErrorwhen the SAF Return Code of a Security Result is greater than- 4.
- AlterOperationError
 Raises- AlterOperationErrorwhen 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
    }
  }
}