can we read privileges using SDK?
In API we do have IRole which we read by Admin instance and nodeconstants.
can we read privileges by any way?
ameansap,
Did you resolve this? And if yes, what did you find out? Could you leave some insight for us here?
No 🙁
I tried IRole and INode but not able to access privileges. We can access roles but not privileges.
INode nodeRoles = (INode)session.getAdminInstance().getNode(NodeConstants.NODE_ROLES);
INode nodepri = (INode)session.getAdminInstance().getNode(NodeConstants.NODE_PRIVILEGES);
IRole role1 = (IRole)nodeRoles.getChildNode(“ViewAllItemsInfo”);
Hi Ameansap,
Yes,we can read privileges using SDK ,Please Refer below piece of code :
IAdmin admin = session.getAdminInstance();
INode node = admin.getNode(“Privileges”);
System.out.println(node.getChildNodes());//get all privileges
INode node1 = (INode) node.getChild(“Create Customers”);//Specify name of your privilege
IProperty[] props = (IProperty[]) node1.getProperties();
for (int i = 0; i < props.length; i++)// loop to check properties of privileges
{
String propname= props[i].getName();
System.out.println(“Name : ” + propname);
Object value = props[i].getValue();
System.out.println(“Value : ” + value);
}
This would help you to read privileges.Let me know if you have any queries.
Thanks,
Kalyani