cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
801
Views
0
Helpful
4
Replies

How to assign existing role to existing enduser

Roberts32364
Level 1
Level 1

Through the AXL Java API, does anyone know how to assign existing users to an existing role?

4 Replies 4

Thanks, I had looked at those.  I just ended up doing a SQL update.  The code is below in case it helps anyone.

 

 

ExecuteSQLUpdateReq sqlUpdateReq = new ExecuteSQLUpdateReq();
ExecuteSQLUpdateRes SQLUpdate;
String update = "insert into enduserdirgroupmap(pkid, fkenduser, fkdirgroup) values(newId(), '%s', '%s')";

/**
 *  fkenduser = pkid of user
 *  fkdirgroup = pkid of group
/**
sqlUpdateReq.setSql(String.format(update, fkenduser, fkdirgroup));

try {
     SQLUpdate = axlPort.executeSQLUpdate(sqlUpdateReq);
} catch (Exception e) {
     e.printStackTrace();
}

 

 

 

I am no fan of doing this by SQL Updates because there you can have pretty strange behavior.

If you use AXL the Interface checks it everything is ok before processing your request.

 

I always recommend to read the AXL documentation and maybe use a get response to see the XML Layout which is working

dstaudt
Cisco Employee
Cisco Employee

Roles are held in User Access Control Groups.  You can manage the membership of these Access Control Groups with AXL via <updateUserGroup>, for example to add user 'dstaudt' to the 'Standard CCM Read Only' Access Control Group (which has 3 roles):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/12.5">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:updateUserGroup sequence="1">
         <name>Standard CCM Read Only</name>
         <addMembers>
            <member>
               <userId>dstaudt</userId>
            </member>
         </addMembers>
      </ns:updateUserGroup>
   </soapenv:Body>
</soapenv:Envelope>

I don't have a Java sample of that particular operation, however this repo has a few that hopefully can get you started in the right direction: https://github.com/CiscoDevNet/axl-java-samples