gov.nih.nci.caarray.services.security
Class RdbmsAuthorizationDAObj

java.lang.Object
  extended by gov.nih.nci.caarray.services.security.RdbmsAuthorizationDAObj
All Implemented Interfaces:
AuthorizationDAItf

public class RdbmsAuthorizationDAObj
extends java.lang.Object
implements AuthorizationDAItf

This authorization data service class is a local implementation of AuthorizationDAItf using the common security RDBMS as the data repository.

Version:
1.0
Author:
Q. Pan

Field Summary
static java.lang.String EMPTY
           
static int SQL_IN_LIMIT
           
 
Constructor Summary
RdbmsAuthorizationDAObj()
          Constructor for a new RdbmsAuthorizationDAObj object.
 
Method Summary
 java.lang.String getOwnerEmail(java.lang.String applicationName, java.lang.String objectId)
          Returns email address of the owner of a given object.
 Role[] getPermission(java.lang.String applicationName, java.lang.String objectId, java.lang.String attribute)
          Returns an array of Roles which has the permission to access the protection element defined by its application name, object ID and attribute.
 boolean hasPermission(java.lang.String userName, java.lang.String[] roles, java.lang.String applicationName, java.lang.String objectId)
          Returns the given role's access permission to a protection element defined by its application name, object ID and attribute.
 java.lang.String[] hasPermission(java.lang.String userName, java.lang.String[] roles, java.lang.String applicationName, java.lang.String[] objectId)
          Returns the given user/roles' access permission to a collection of protection elements defined by its application name, object ID and attribute.
 java.lang.String[] hasPermission(java.lang.String userName, java.lang.String[] roles, java.lang.String applicationName, java.lang.String[] objectId, long[] protectionGroups)
          Returns the given user/role's access permission to a collection of protection elements defined by its application name, object ID and attribute.
 boolean hasPermission(java.lang.String userName, java.lang.String role, java.lang.String applicationName, java.lang.String objectId)
          Returns the given role's access permission to a protection element defined by its application name, object ID and attribute.
 java.lang.String[] hasPermission(java.lang.String userName, java.lang.String role, java.lang.String applicationName, java.lang.String[] objectId)
          Returns the given role's access permission to a protection element defined by its application name, object ID and attribute.
 java.lang.String[] hasPermission(java.lang.String userName, java.lang.String role, java.lang.String applicationName, java.lang.String[] objectId, long[] protectionGroupId)
          Returns the given role's access permission to a protection element defined by its application name, object ID and attribute.
 boolean isOwner(java.lang.String loginName, java.lang.String applicationName, java.lang.String objectId)
          Returns an item's ownership for the given user.
 java.lang.String[] isOwner(java.lang.String loginName, java.lang.String applicationName, java.lang.String[] objectId)
          Returns an item's ownership for the given user.
 java.lang.String[] isOwner(java.lang.String loginName, java.lang.String applicationName, java.lang.String[] objectId, long[] protectionGroupId)
          Returns an item's ownership for the given user.
 java.lang.String[] isOwnerOnly(java.lang.String loginName, java.lang.String applicationName, java.lang.String[] objectId)
          Returns an item's ownership for the given user.
static java.lang.String join(java.lang.Object[] array, java.lang.String separator, java.lang.String wrapElementsWithThisString)
          Joins the elements of the provided array into a single String containing the provided list of elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQL_IN_LIMIT

public static final int SQL_IN_LIMIT

EMPTY

public static final java.lang.String EMPTY
See Also:
Constant Field Values
Constructor Detail

RdbmsAuthorizationDAObj

public RdbmsAuthorizationDAObj()
Constructor for a new RdbmsAuthorizationDAObj object.

Method Detail

hasPermission

public boolean hasPermission(java.lang.String userName,
                             java.lang.String role,
                             java.lang.String applicationName,
                             java.lang.String objectId)
Returns the given role's access permission to a protection element defined by its application name, object ID and attribute.

Specified by:
hasPermission in interface AuthorizationDAItf
Parameters:
role - role
applicationName - application name
objectId - object ID
userName - login name
Returns:
true for having the access permission false for having no access permission

hasPermission

public java.lang.String[] hasPermission(java.lang.String userName,
                                        java.lang.String role,
                                        java.lang.String applicationName,
                                        java.lang.String[] objectId)
Returns the given role's access permission to a protection element defined by its application name, object ID and attribute. OverLoaded to support collection of SecuredElementItf.

Specified by:
hasPermission in interface AuthorizationDAItf
Parameters:
role - role
applicationName - application name
objectId - object ID
Returns:
true for having the access permission false for having no access permission

hasPermission

public java.lang.String[] hasPermission(java.lang.String userName,
                                        java.lang.String role,
                                        java.lang.String applicationName,
                                        java.lang.String[] objectId,
                                        long[] protectionGroupId)
Returns the given role's access permission to a protection element defined by its application name, object ID and attribute. OverLoaded to support collection of SecuredElementItf.

Specified by:
hasPermission in interface AuthorizationDAItf
Parameters:
userName -
role - role
applicationName - application name
objectId - object ID
protectionGroups - - limit the results to objects in these protection groups
Returns:
true for having the access permission false for having no access permission

getOwnerEmail

public java.lang.String getOwnerEmail(java.lang.String applicationName,
                                      java.lang.String objectId)
Returns email address of the owner of a given object.

Specified by:
getOwnerEmail in interface AuthorizationDAItf
Parameters:
applicationName - application name
objectId - object ID
Returns:
email address of the owner

isOwner

public boolean isOwner(java.lang.String loginName,
                       java.lang.String applicationName,
                       java.lang.String objectId)
Returns an item's ownership for the given user.

Specified by:
isOwner in interface AuthorizationDAItf
Parameters:
loginName - login name
applicationName - application name
objectId - object ID
Returns:
true if the user is the owner false if the user is not the owner

isOwner

public java.lang.String[] isOwner(java.lang.String loginName,
                                  java.lang.String applicationName,
                                  java.lang.String[] objectId,
                                  long[] protectionGroupId)
Returns an item's ownership for the given user.

Specified by:
isOwner in interface AuthorizationDAItf
Parameters:
loginName - login name
applicationName - application name
objectId - object IDs
objectId - protection Group Ids to limit the search to
Returns:
true if the user is the owner false if the user is not the owner

isOwner

public java.lang.String[] isOwner(java.lang.String loginName,
                                  java.lang.String applicationName,
                                  java.lang.String[] objectId)
Returns an item's ownership for the given user.

Specified by:
isOwner in interface AuthorizationDAItf
Parameters:
loginName - login name
applicationName - application name
objectId - object ID
Returns:
true if the user is the owner false if the user is not the owner

isOwnerOnly

public java.lang.String[] isOwnerOnly(java.lang.String loginName,
                                      java.lang.String applicationName,
                                      java.lang.String[] objectId)
                               throws DBException
Returns an item's ownership for the given user. Returned items not part of any protection Group

Specified by:
isOwnerOnly in interface AuthorizationDAItf
Parameters:
loginName - login name
applicationName - application name
objectId - object ID
Returns:
true if the user is the owner false if the user is not the owner
Throws:
DBException

getPermission

public Role[] getPermission(java.lang.String applicationName,
                            java.lang.String objectId,
                            java.lang.String attribute)
Returns an array of Roles which has the permission to access the protection element defined by its application name, object ID and attribute.

Specified by:
getPermission in interface AuthorizationDAItf
Parameters:
applicationName - application name
objectId - object ID
attribute - attribute
Returns:
an array of Roles which has the permission to access the protection element

join

public static java.lang.String join(java.lang.Object[] array,
                                    java.lang.String separator,
                                    java.lang.String wrapElementsWithThisString)

Joins the elements of the provided array into a single String containing the provided list of elements.

No delimiter is added before or after the list. A null separator is the same as an empty String (""). Null objects or empty strings within the array are represented by empty strings.

 StringUtils.join(null, *)                = null
 StringUtils.join([], *)                  = ""
 StringUtils.join([null], *)              = ""
 StringUtils.join(["a", "b", "c"], "--")  = "a--b--c"
 StringUtils.join(["a", "b", "c"], null)  = "abc"
 StringUtils.join(["a", "b", "c"], "")    = "abc"
 StringUtils.join([null, "", "a"], ',')   = ",,a"
 

Parameters:
array - the array of values to join together, may be null
separator - the separator character to use, null treated as ""
Returns:
the joined String, null if null array input

hasPermission

public java.lang.String[] hasPermission(java.lang.String userName,
                                        java.lang.String[] roles,
                                        java.lang.String applicationName,
                                        java.lang.String[] objectId)
Description copied from interface: AuthorizationDAItf
Returns the given user/roles' access permission to a collection of protection elements defined by its application name, object ID and attribute. - Overloaded method.

Specified by:
hasPermission in interface AuthorizationDAItf
roles - role names
applicationName - application name
objectId - object ID
Returns:
true for having the access permission false for having no access permission

hasPermission

public java.lang.String[] hasPermission(java.lang.String userName,
                                        java.lang.String[] roles,
                                        java.lang.String applicationName,
                                        java.lang.String[] objectId,
                                        long[] protectionGroups)
Description copied from interface: AuthorizationDAItf
Returns the given user/role's access permission to a collection of protection elements defined by its application name, object ID and attribute. - Overloaded method.

Specified by:
hasPermission in interface AuthorizationDAItf
roles - role names
applicationName - application name
objectId - object ID
Returns:
true for having the access permission false for having no access permission

hasPermission

public boolean hasPermission(java.lang.String userName,
                             java.lang.String[] roles,
                             java.lang.String applicationName,
                             java.lang.String objectId)
Description copied from interface: AuthorizationDAItf
Returns the given role's access permission to a protection element defined by its application name, object ID and attribute.

Specified by:
hasPermission in interface AuthorizationDAItf
Parameters:
userName - login name
applicationName - application name
objectId - object ID
Returns:
true for having the access permission false for having no access permission