This is an example of setting the List of MdPermissionInfo instances for a single Identity object. Each MdPermissionInfo instance added to the List represents the GRANT or DENY for valid Permission name. A Permission name should only be granted or denied once.
try
{
CMetadata object; // any SAS CMetadata object type will work here (your code must fill this in)
MdAuthorizationUtil authUtil = object.getAuthorizationUtil();
Identity identity; // A single Identity object (probably from the List returned by Example 2.)
// GRANT ReadMetadata and DENY WriteMetdata for this Identity
List <MdPermissionInfo>permInfoList = new ArrayList<MdPermissionInfo>(2);
permInfoList.add(new MdPermissionInfoImpl(
PermissionType.GRANT, MdPermissionInfo.PERMISSION_READMETADATA ));
permInfoList.add(new MdPermissionInfoImpl(
PermissionType.DENY, MdPermissionInfo.PERMISSION_WRITEMETADATA ));
authUtil.setAuthorizations(identity, permInfoList);
}
catch (MdException e)
{
e.printStackTrace();
}
catch (RemoteException e)
{
e.printStackTrace();
}