Expand my Community achievements bar.

Strange things in sdk of Rights Managerment ES

Avatar

Former Community Member
Very strange,the principles I get from policies, seem different from the principals I get from the DirectoryManagerServiceClient by userid , groupName etc.I just want to change a policy by remove some policy entries and add some others policy entries, but I can't remove the original policy entry by the common Name , canonical Name and domain Name,because DirectoryManagerServiceClient can't find any principal with these information.

following is my code:

public static void testDescriber(){

try

{

//Create a ServiceClientFactory object

ServiceClientFactory myFactory = PolicyClientFactory.getInstance().getServiceClientFactory();

//Create a RightsManagementClient object

RightsManagementClient rightsClient = new RightsManagementClient(myFactory);



PolicyManager polmanager = rightsClient.getPolicyManager();





DirectoryManagerServiceClient dirClient = PolicyClientFactory.getInstance().getDirectoryManagerServiceClient();

Policy myPolicy = polmanager.getPolicy("policy_with_UserAndGroup", "policy_test_groupAndUser");



List entries = myPolicy.getPolicyEntries();

System.out.println(entries);

if(entries != null && entries .size() > 0){

for(int i = 0 ; i < entries .size() ; i ++){

PolicyEntry entry = (PolicyEntry)entries.get(i);

Principal principal = entry.getPrincipal();

PrincipalReference pref = dirClient.findPrincipalReference(principal.getDomainName(),principal.getCanonicalName());

System.out.println(principal.getCommonName());

System.out.println(principal.getDescription());

PrincipalSearchFilter psf = new PrincipalSearchFilter();

psf.setCanonicalName(principal.getCanonicalName());

psf.setPrincipalType(Principal.PRINCIPALTYPE_USER);



List refList = dirClient.findPrincipalReferences(psf);

for(int j = 0 ; j < refList.size() ; j ++){

PrincipalReference pr = (PrincipalReference)refList.get(j);

System.out.println(pr.getCommonName());

System.out.println(pr.getDomainCommonName());

}

// List permissions = entry.getPermissions();

// for(int j = 0 ; j < permissions.size() ; j ++ ){

// Permission permission = (Permission)permissions.get(j);

// System.out.println(permission.getName());

// }

//



}

}





//Create a policy object

}catch(Exception e){

e.printStackTrace();

}

}



the result :

null

null

Document Publisher

EDC_SPECIAL

null

null



just the document publisher appeared ,the others are null

anyone knows ?
4 Replies

Avatar

Former Community Member

any solution for such effects out there?

Thanks a lot,
Dilettanto

Avatar

Level 2

Anyone has a solution to this problem?