cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
861
Views
10
Helpful
3
Replies

Failing to add end user to access control group via python/zeep

I am trying to add a CUCM end user to an access control group. First I was trying update userUser to do this.

 

 

 

                            resp = destination_axl.updateUser(
                                **{ 'userid': userid,
                                'homeCluster': 'true',
                                'imAndPresenceEnable': 'true',
                                'primaryExtension': { 'pattern': primary_line['pattern'], 'routePartitionName': primary_line['routePartitionName'], },
                                'lineAppearanceAssociationForPresences': {
                                    lineAppearanceAssociationForPresence: [
                                        {
                                            'laapAssociate': 't',
                                            'laapProductType': dphone['return']['phone']['product'],
                                            'laapDeviceName': dphone['return']['phone']['name'],
                                            'laapDirectory': primary_line['pattern'],
                                            'laapPartition': primary_line['routePartitionName'],
                                            'laapDescription': dphone['return']['phone']['description'],
                                        }
                                    ]
                                },
                                'associatedGroups': {
                                    'userGroup': [
                                        {
                                            'name': 'Standard CTI Enabled',
                                            'userRoles': { 'userRole': [ 'Standard CTI Enabled' ] }
                                        },
                                        {
                                            'name': 'Standard CCM End Users',
                                            'userRoles': { 'userRole': [ 'Standard CCM End Users', 'Standard CCMUSER Administration' ] }
                                        }
                                    ]
                                },
                                }
                                )

 

 

 

 Everything updated except for the group. Then I was thinking I needed to use addMembers in updateUserGroup, but I am failing to find the right syntax. I am looking at the AXL Schema Reference, but it isn't clicking. I tried to google some examples as well, but I am striking out there too.

1 Accepted Solution

Accepted Solutions

dstaudt
Cisco Employee
Cisco Employee

Not sure I can spot any difference from your code, but I did update this sample to show updating associatedGroups: https://github.com/CiscoDevNet/axl-python-zeep-samples/blob/master/axl_add_update_User.py

groups = {
    'userGroup': [
        {
            'name': 'Standard CTI Enabled',
            'userRoles': {
                'userRole': [
                    'Standard CTI Enabled'
                ]
            }
        },
        {
            'name': 'Standard CCM End Users',
            'userRoles': {
                'userRole': [
                    'Standard CCM End Users', 'Standard CCMUSER Administration'
                ]
            }
        }
    ]
}

# Execute the updateUser request
try:
    resp = service.updateUser(
        userid='testEndUser',
        associatedDevices = devices,
        associatedGroups = groups,
        homeCluster=True,
        imAndPresenceEnable=True
    )

View solution in original post

3 Replies 3

npetrele
Cisco Employee
Cisco Employee

This is an example of how you do it with XML.  I assume you just have to reinterpret this into JSON.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/14.0">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:updateUserGroup>
         <name>Standard CTI Enabled</name>
         <addMembers>
            <member>
               <userId>nicholas</userId>
            </member>
         </addMembers>
      </ns:updateUserGroup>
   </soapenv:Body>
</soapenv:Envelope>

dstaudt
Cisco Employee
Cisco Employee

Not sure I can spot any difference from your code, but I did update this sample to show updating associatedGroups: https://github.com/CiscoDevNet/axl-python-zeep-samples/blob/master/axl_add_update_User.py

groups = {
    'userGroup': [
        {
            'name': 'Standard CTI Enabled',
            'userRoles': {
                'userRole': [
                    'Standard CTI Enabled'
                ]
            }
        },
        {
            'name': 'Standard CCM End Users',
            'userRoles': {
                'userRole': [
                    'Standard CCM End Users', 'Standard CCMUSER Administration'
                ]
            }
        }
    ]
}

# Execute the updateUser request
try:
    resp = service.updateUser(
        userid='testEndUser',
        associatedDevices = devices,
        associatedGroups = groups,
        homeCluster=True,
        imAndPresenceEnable=True
    )

Thanks (again). I must be missing something in the syntax because I can't see the difference in the groups between your code and mine, but your works and mine doesn't. Urgh!