The following code fragment
shows how the SetAuthorizationsOnObj method is issued in a Java environment:
public void setAuthorizationsOnObj(String transCtxt, String resource, int options,
String[][] auths ) throws Exception {
try
{
iSecurityAdmin.SetAuthorizationsOnObj(transCtxt,
resource,
options,
auths
);
}
catch (Exceptions e) {
System.out.println("SetAuthorizationsOnObj: Exceptions");
e.printStackTrace();
throw e;
}
}
The following example
issues the SetAuthorizationsOnObj to define authorizations in a predefined
ACT identified as ACTspec.
public void defineACT() throws Exception {
// Authorizations to place in the ACT
final String[][] ACTauths =
{{"IdentityGroup", Public, "D", "ReadMetadata", ""},
{"IdentityGroup", Public, "D", "WriteMetadata", ""},
{"Person", testUserName, "G", "ReadMetadata", ""},
{"Person", testUserName, "G", "WriteMemberMetadata",""},
{"Person", testUserName, "G", "CheckinMetadata", ""}};
try {
// Set the authorizations defined in ACTauths on the ACT identified by ACTspec.
// Note that tCtxt is null, because resource has a value.
iSecurityAdmin. setAuthorizationsOnObj("", ACTspec, ISecurityAdmin.SECAD_ACT_CONTENTS,
ACTauths);
}
catch (Exception e ){
throw e;
}
}