Previous Page | Next Page

Authorization (ISecurity Interface)

GetAuthorizations

Gets authorization information for a resource, depending on the type of authorization requested.

Category: Authorization methods

Interface version: ISecurity 1.0


Syntax

GetAuthorizations(authType,credHandle,resource,permission,authorizations);


Parameters

Parameter Type Direction Description
authType string in The type of authorization to perform.
credHandle string in Credential handle identifying a user identity, or an empty string.
resource string in Passed resource identifier.
permission string in Mnemonic representation of the permission for which authorization is being requested. This parameter can be an empty string for some AUTHTYPE values.
authorizations string array out Returned two-dimensional string array. The content and structure of the array varies depending on the authorization type specified in the AUTHTYPE parameter.


Details

The GetAuthorizations method performs authorization queries. The input for processing the query, and the format and content of the information returned, are determined by the AUTHTYPE parameter. Currently, the only supported AUTHTYPE value is Cube.

Cube returns an array of strings[*][4]. The number of rows depends on the structure of the cube. Each row has the following four columns:

Type

Indicates the metadata type in the row. This is either Hierarchy, Dimension, Measure, or Level.

Name

Returns the Name= attribute of the metadata type instance.

Authorized

Returns a Y or N, indicating whether the permission being requested has been granted to the user in this cube component.

PermissionCondition

When the Authorized column has a value of Y, this column returns a condition that must be enforced on the cube component to allow access. For more information, see the description of the PERMISSIONCONDITION parameter in IsAuthorized.

If the CREDHANDLE parameter is an empty string, the method returns authorizations for the calling user.


Exceptions Thrown

The SAS Open Metadata Interface explicitly returns the following exceptions for the GetAuthorizations method:


Examples

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. The value "Cube" is
 // the only supported authType. "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() >>>>


Related Methods

Previous Page | Next Page | Top of Page