The following is a Java
example of a GetAuthorizations method. The method call gets authorizations
for a cube. Code is included that formats and prints the results of
the request.
public void getAuthorizationsforCube() throws Exception {
try
{
// Issue GetAuthorizations on a predefined cube. Assume that a credential
// handle was obtained earlier. Supported authType values are “Cube”
// or "SharedDimension". This call gets authorizations for a cube.
// “Read” is the permission being sought.
iSecurity.GetAuthorizations("Cube", credHandle.value, cube_URN, "Read", auths);
System.out.println();
// Specifies to print a title and parameter values.
System.out.println("<<<<<< getAuthorizations() call parameters
(Read Permission) with results >>>>>>");
System.out.println("credHandle=" + credHandle.value);
System.out.println("resourceURN=" + cube_URN);
System.out.println("permission=Read");
// Defines a string array to store method output
String[][] returnArray = auths.value;
for (int i=0; i < returnArray.length; i++ )
{
String[] returnRow = returnArray[i];
// Return values are in fixed column positions:
// Type | Name | Authorized (Y/N) | PermissonCondition
System.out.print("Type="+returnRow[0] + ", ");
System.out.print("Name="+returnRow[1] + ", ");
System.out.print("Authorized="+returnRow[2] + ", ");
System.out.print("PermissonCondition="+returnRow[3]);
System.out.println(); // force NewLine
}
System.out.println("<<<< End getAuthorizationsForCube() >>>>" );
}
// Catch the method's exceptions.
catch (Exception e) {
System.out.println("GetAuthorizations: GetInfo: other Exception");
e.printStackTrace();
throw e;
}
}
Here is the output from
the request:
<<<<<< getAuthorizations() call parameters (Read Permission) with results >>>>>>
credHandle=33f824f400000003
resourceURN=OMSOBJ:Cube/A5CY5BIY.AS000001
permission=Read
Type=Hierarchy, Name=testHier1, Authorized=Y, PermissonCondition=
Type=Dimension, Name=testDim1, Authorized=Y, PermissonCondition=
Condition for an OLAP Dimension
Type=Dimension, Name=testDim2, Authorized=N, PermissonCondition=
<<<< End getAuthorizationsForCube() >>>>