154 15 19 32

The variables retrieved by AuthorizationAgent.getPermissionVariable(..) method and an example

I uses Open DACS Java API and it provides AuthorizationAgent.getPermissionVariable(handle, status, sVariableName, sVariableData) but I cannot find what permission variables can be got via the method and the example using the method.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

9.6k 10 7 7

The AuthorizationAgent.getPermissionVariable(com.reuters.rfa.common.Handle handle, AuthorizationCheckStatus status, java.lang.String sVariableName,String[] sVariableData) method finds a value with a variable name. The variables and their meanings are listed below:

  1. U.ITEM.MAX.AGGREGATE - The maximum number of items that the user can open. This value is specific to a user.
  2. DACS_API_VERSION - The version of the DACS API which OpenDACS API uses to communicating with DACS/the version of the DACS API that enforces permissions. This value is global in nature and unrelated to a user.

The example source code using the method:

 //after you can login and get the valid handle ,_handle.
AuthorizationCheckStatus authCheckStatus = new AuthorizationCheckStatus();
String sVariableName = "U.ITEM.MAX.AGGREGATE";
//String sVariableName = "DACS_API_VERSION";
String[] sVariableData=new String[3];
try {
// Get the permission variable value given a variable name for a given user handle.
   AuthorizationCheckResult authCheckResult = _agent.getPermissionVariable(_handle,authCheckStatus,sVariableName , sVariableData);
   // Check the result of calling the getPermissionVariable() method.
   if (authCheckResult == AuthorizationCheckResult.ACCESS_ALLOWED) 
      System.out.print("[" + _daemonHost + "] " + _name +
         " allow access of " + sVariableName + ". The value is " );
         for(String aData:sVariableData)
               System.out.print(aData + ",");
   else {
      System.out.println("[" + _daemonHost + "] " + _name + " denied access of " + sVariableName);
      System.out.println("status message - " + authCheckStatus.getStatusText());
} catch (AuthorizationException ae) 
// In case the exception occurs during calling method.
   System.err.println("[" + _daemonHost + "] " + _name +
      " check get Permission variable named " + sVariableName + " failed");
   System.out.println("Exception message - " + ae.getMessage());

If the method lookup is successful, you will be able to get the value of the variable. The example output:

  • When the Variable Name is U.ITEM.MAX.AGGREGATE
[] pimchaya allow access of U.ITEM.MAX.AGGREGATE. The value is 20,
  • When the Variable Name is DACS_API_VERSION
[] pimchaya allow access of DACS_API_VERSION. The value is dacs6.7.0.F2,

If the method lookup is failure, you will get AuthorizationCheckResult.ACCESS_DENIED and you can get the reason in AuthorizationCheckStatus.getStatusText(). Based on my test,the U.ITEM.MAX.AGGREGATE can be failed to look up if the Aggregate Item Limit of the user is not set(blank) or the DACS e.g. version 6.3 does not provide the interface to set the Aggregate Item Limit of the user. The example output:

[] chongdee denied access of U.ITEM.MAX.AGGREGATE
status message - Authorization Check not set 
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.