Connect

Create or change a group connection.

ConnectionAdmin.connect()

def connect(self, userid: str, group: str, traits: dict = {}) -> Union[dict, bytes]:

📄 Description

 

Only a subset of available Traits are considered Stable. See Traits for more details.

 

Alter operations in pyracf require READ access to IRR.IRRSMO00.PRECHECK in the XFACILIT class This function will not produce output unless the user running the command has this access.

 

Create or change a group connection.

📥 Parameters

  • userid
    The z/OS userid of the user whose connection to the specified group is being created or changed.
  • group
    The group to which the user’s connection is being created or changed.

  • traits
    A dictionary of traits/attributes that will be connected for the specified user’s connection to the specifed group. See Traits to see what all of the valid Group Connection Traits are.

📤 Returns

  • Union[dict, bytes]
    Returns a Security Result dictionary or Security Request XML bytes if the ConnectionAdmin.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.
  • SegmentTraitError
    Raises SegmentTraitError when the dictionary of traits/attributes provided contains one or more unknown traits.

💻 Example

The following example connects an existing group connection where the connection of z/OS userid squidwrd to group testgrp0 will be connected with the traits/attributes defined in the traits dictionary.

Python Script
from pyracf import ConnectionAdmin
connection_admin = ConnectionAdmin()

traits = {
    "base:auditor": False,
    "base:operations": False,
    "base:special": True
}

connection_admin.connect("squidwrd", "testgrp0", traits=traits)
Security Result Dictionary as JSON
{
  "securityResult": {
    "groupConnection": {
      "name": "SQUIDWRD",
      "group": "TESTGRP0",
      "operation": "set",
      "requestId": "ConnectionRequest",
      "commands": [
        {
          "safReturnCode": 0,
          "returnCode": 0,
          "reasonCode": 0,
          "image": "CONNECT SQUIDWRD  GROUP       (TESTGRP0) NOAUDITOR      NOOPERATIONS   SPECIAL     "
        }
      ]
    },
    "returnCode": 0,
    "reasonCode": 0,
    "runningUserid": "testuser"
  }
}