on 2012 Nov 27 5:26 PM
I'm working on a program that will provide documentation about various parts of the CMS - currently working in BO XI 3.1 sp5, but I will want to migrate this code to 4.0 as well. As part of this, I'd like to output all of the access levels (standard and custom) with their associated rights - the same info you see when you view the included rights for an access level in the CMC. I can get to the access level info, but it's not clear in the documentation how to get to the rights info. I'm very familiar with the .NET SDK, but this is something that's not available there, so I have to do it in Java which I've done just a little work with.
Here is the code I have so far:
String query = "Select * from CI_SYSTEMOBJECTS where SI_KIND='CustomRole'";
IInfoObjects iobjs = store.query(query);
if (iobjs.getResultSize() > 0){
Iterator<IInfoObject> iobjIt = iobjs.iterator();
while(iobjIt.hasNext()){
ICustomRole role = (ICustomRole) obj;
ISecurityInfo2 si = role.getSecurityInfo2();
IPluginBasedRightIDs prights = si.getKnownRightsByPlugin();
//What to do from here?
}
}
What method do I use to get the list of rights: getMetaPluginRights(), getPluginCustomRights(), or getPluginRights()? Or do I have to use some combination of the three? If it's one of the latter two methods, how do I navigate the Map to get to the information I need?
Code samples would be greatly appreciated. Thanks!
-Dell
I think I've finally figured it out. The code above looks at the access rights to the access level, which is not what I want.
Here's what actually works:
String query = "Select * from CI_SYSTEMOBJECTS where SI_KIND='CustomRole'";
IInfoObjects iobjs = store.query(query);
if (iobjs.getResultSize() > 0){
Iterator<IInfoObject> iobjIt = iobjs.iterator();
while(iobjIt.hasNext()){
String rtInfo = "\"%1s\",%2s,%3s,\"%4s\",%5s,%6s";
ICustomRole role = (ICustomRole) obj;
IRoleRights rights = role.getRoleRights();
Iterator<IRoleRight> rightsIt = rights.iterator;
while (rightsIt.hasNext()) {
IRoleRight right = rightsIt.next();
String isOwner = (right.getOwnerRight()?"Owner":"");
String isGranted = (right.getGranted()?"Granted":"Denied");
_output.write(String.format(rtInfo, obj.getTitle(), right.getCollection(null), right.getCategory(null), right.getDescription(null), isOwner, isGranted));
_output.newLine();
}
}
}
Unfortunately, I've had to use GetCategory() and GetCollection(), both of which have been deprecated. I'm still trying to figure out how to get the same information (which is shown in the CMC!) using the newer methods.
-Dell
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
62 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.