it.eng.spagobi.commons.utilities
Class ObjectsAccessVerifier

java.lang.Object
  extended by it.eng.spagobi.commons.utilities.ObjectsAccessVerifier

public class ObjectsAccessVerifier
extends java.lang.Object

Contains some methods to control user exec/dev/test rights.

Author:
sulis

Constructor Summary
ObjectsAccessVerifier()
           
 
Method Summary
static boolean canDeleteBIObject(int biobjectId, it.eng.spago.security.IEngUserProfile profile)
          Returns true if the user in input is able to delete the input object everywhere
static boolean canDeleteBIObject(int biobjectId, it.eng.spago.security.IEngUserProfile profile, LowFunctionality lowFunctionality)
          Returns true if the user in input is able to delete the input object in the specified position (folder)
static boolean canDev(java.lang.Integer folderId, it.eng.spago.security.IEngUserProfile profile)
          Control if the current user can develop new object into the functionality identified by its id.
static boolean canDev(java.lang.String state, java.lang.Integer folderId, it.eng.spago.security.IEngUserProfile profile)
          Controls if the current user can develop the object relative to the input folder id.
static boolean canDev(java.lang.String state, java.util.List folders, it.eng.spago.security.IEngUserProfile profile)
          Metodo che verifica se nell'elenco delle funzionalit� ne esiste almeno una con diritto di esecuzione
static boolean canDevBIObject(BIObject obj, it.eng.spago.security.IEngUserProfile profile)
          Control if the user can develop the input document
static boolean canDevBIObject(java.lang.Integer biObjectID, it.eng.spago.security.IEngUserProfile profile)
          Control if the user can develop the document specified by the input id
static boolean canExec(java.lang.Integer folderId, it.eng.spago.security.IEngUserProfile profile)
          Control if the current user can execute new object into the functionality identified by its id.
static boolean canExec(LowFunctionality folder, it.eng.spago.security.IEngUserProfile profile)
          Control if the current user can execute objects into the input functionality.
static boolean canExec(java.lang.String state, java.lang.Integer folderId, it.eng.spago.security.IEngUserProfile profile)
          Controls if current user can exec the object relative to the input folder id.
static boolean canExec(java.lang.String state, java.util.List folders, it.eng.spago.security.IEngUserProfile profile)
          Metodo che verifica se nell'elenco delle funzionalit� ne esiste almeno una con diritto di esecuzione
static boolean canSee(BIObject obj, it.eng.spago.security.IEngUserProfile profile)
          Controls if the current user can see the document: - if the document is in DEV state the user must have the development permission in a folder containing it; - if the document is in TEST state the user must have the test permission in a folder containing it; - if the document is in REL state the user must have the execution permission in a folder containing it.
static boolean canSee(LowFunctionality lowFunctionality, it.eng.spago.security.IEngUserProfile profile)
          Controls if the user can see the LowFunctionality.
static boolean canTest(java.lang.Integer folderId, it.eng.spago.security.IEngUserProfile profile)
          Control if the current user can test new object into the functionality identified by its id.
static boolean canTest(java.lang.String state, java.lang.Integer folderId, it.eng.spago.security.IEngUserProfile profile)
          Control if current user can test the object relative to the folder id.
static boolean canTest(java.lang.String state, java.util.List folders, it.eng.spago.security.IEngUserProfile profile)
          Metodo che verifica se nell'elenco delle funzionalit� ne esiste almeno una con diritto di esecuzione
static boolean checkProfileVisibility(BIObject obj, it.eng.spago.security.IEngUserProfile profile)
          Checks if the document in input has profiled visibility constraints.
static java.util.List getCorrectRolesForExecution(java.lang.Integer objectId, it.eng.spago.security.IEngUserProfile profile)
          returns the list of correct roles of the input profile for the execution of the document with the specified input
static java.lang.String getPermissionFromDocumentState(java.lang.String documentState)
          Retrieves the correct permission on folder that the user must have in order to execute the document: eg: document state = REL --> permission to EXECUTION document state = DEV --> permission to DEVELOPMENT document state = TEST --> permission to TEST
static int getVisibleInstances(java.lang.String initialPath, java.util.List folders)
          Metodo che verifica il numero di istanze visibili del documento
static boolean isAbleToExec(java.lang.String state, it.eng.spago.security.IEngUserProfile profile)
           
static boolean isAbleToSave(org.json.JSONArray documentfolders, it.eng.spago.security.IEngUserProfile profile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectsAccessVerifier

public ObjectsAccessVerifier()
Method Detail

canDev

public static boolean canDev(java.lang.String state,
                             java.lang.Integer folderId,
                             it.eng.spago.security.IEngUserProfile profile)
Controls if the current user can develop the object relative to the input folder id.

Parameters:
state - state of the object
folderId - The id of the folder containing te object
profile - user profile
Returns:
A boolean control value

canExec

public static boolean canExec(java.lang.String state,
                              java.lang.Integer folderId,
                              it.eng.spago.security.IEngUserProfile profile)
Controls if current user can exec the object relative to the input folder id.

Parameters:
state - state of the object
folderId - The id of the folder containing te object
profile - user profile
Returns:
A boolean control value

canExec

public static boolean canExec(java.lang.String state,
                              java.util.List folders,
                              it.eng.spago.security.IEngUserProfile profile)
Metodo che verifica se nell'elenco delle funzionalit� ne esiste almeno una con diritto di esecuzione

Parameters:
state -
profile -
Returns:

canDev

public static boolean canDev(java.lang.String state,
                             java.util.List folders,
                             it.eng.spago.security.IEngUserProfile profile)
Metodo che verifica se nell'elenco delle funzionalit� ne esiste almeno una con diritto di esecuzione

Parameters:
state -
profile -
Returns:

canTest

public static boolean canTest(java.lang.String state,
                              java.util.List folders,
                              it.eng.spago.security.IEngUserProfile profile)
Metodo che verifica se nell'elenco delle funzionalit� ne esiste almeno una con diritto di esecuzione

Parameters:
state -
profile -
Returns:

getVisibleInstances

public static int getVisibleInstances(java.lang.String initialPath,
                                      java.util.List folders)
Metodo che verifica il numero di istanze visibili del documento

Parameters:
state -
userProfile -
Returns:

isAbleToExec

public static boolean isAbleToExec(java.lang.String state,
                                   it.eng.spago.security.IEngUserProfile profile)

isAbleToSave

public static boolean isAbleToSave(org.json.JSONArray documentfolders,
                                   it.eng.spago.security.IEngUserProfile profile)
                            throws it.eng.spago.error.EMFInternalError,
                                   org.json.JSONException
Throws:
it.eng.spago.error.EMFInternalError
org.json.JSONException

canTest

public static boolean canTest(java.lang.String state,
                              java.lang.Integer folderId,
                              it.eng.spago.security.IEngUserProfile profile)
Control if current user can test the object relative to the folder id.

Parameters:
state - state of the object
folderId - The id of the folder containing the object
profile - user profile
Returns:
A boolean control value

canDevBIObject

public static boolean canDevBIObject(java.lang.Integer biObjectID,
                                     it.eng.spago.security.IEngUserProfile profile)
Control if the user can develop the document specified by the input id

Parameters:
documentId - The id of the document
profile - The user profile
Returns:
A boolean control value

canDevBIObject

public static boolean canDevBIObject(BIObject obj,
                                     it.eng.spago.security.IEngUserProfile profile)
Control if the user can develop the input document

Parameters:
documentId - The id of the document
profile - The user profile
Returns:
A boolean control value

canDev

public static boolean canDev(java.lang.Integer folderId,
                             it.eng.spago.security.IEngUserProfile profile)
Control if the current user can develop new object into the functionality identified by its id.

Parameters:
folderId - The id of the lowFunctionality
profile - user profile
Returns:
A boolean control value

canTest

public static boolean canTest(java.lang.Integer folderId,
                              it.eng.spago.security.IEngUserProfile profile)
Control if the current user can test new object into the functionality identified by its id.

Parameters:
folderId - The id of the lowFunctionality
profile - user profile
Returns:
A boolean control value

canExec

public static boolean canExec(LowFunctionality folder,
                              it.eng.spago.security.IEngUserProfile profile)
Control if the current user can execute objects into the input functionality.

Parameters:
folder - The lowFunctionality
profile - user profile
Returns:
A boolean control value

canExec

public static boolean canExec(java.lang.Integer folderId,
                              it.eng.spago.security.IEngUserProfile profile)
Control if the current user can execute new object into the functionality identified by its id.

Parameters:
folderId - The id of the lowFunctionality
profile - user profile
Returns:
A boolean control value

canSee

public static boolean canSee(BIObject obj,
                             it.eng.spago.security.IEngUserProfile profile)
                      throws it.eng.spago.error.EMFInternalError
Controls if the current user can see the document: - if the document is in DEV state the user must have the development permission in a folder containing it; - if the document is in TEST state the user must have the test permission in a folder containing it; - if the document is in REL state the user must have the execution permission in a folder containing it.

Parameters:
obj - The BIObject
profile - user profile
Returns:
A boolean control value
Throws:
it.eng.spago.error.EMFInternalError - the EMF internal error

canSee

public static boolean canSee(LowFunctionality lowFunctionality,
                             it.eng.spago.security.IEngUserProfile profile)
                      throws it.eng.spago.error.EMFInternalError
Controls if the user can see the LowFunctionality. The root LowFunctionality is visible by everybody. The administrator can see all LowFunctionalities. Other users can see the LowFunctionality only if they have at least one of the following permission: - they can develop on that folder; - they can test on that folder; - they can execute on that folder.

Parameters:
lowFunctionality - The LowFunctionality
profile - user profile
Returns:
true if the user can see the specified lowFunctionality, false otherwise
Throws:
it.eng.spago.error.EMFInternalError - the EMF internal error

checkProfileVisibility

public static boolean checkProfileVisibility(BIObject obj,
                                             it.eng.spago.security.IEngUserProfile profile)
                                      throws it.eng.spago.error.EMFInternalError
Checks if the document in input has profiled visibility constraints. If it is the case, checks if the user in input has suitable profile attributes.

Parameters:
obj -
profile -
Returns:
true if document profiled visibility constraints are satisfied by the user
Throws:
it.eng.spago.error.EMFInternalError

getCorrectRolesForExecution

public static java.util.List getCorrectRolesForExecution(java.lang.Integer objectId,
                                                         it.eng.spago.security.IEngUserProfile profile)
                                                  throws it.eng.spago.error.EMFInternalError,
                                                         it.eng.spago.error.EMFUserError
returns the list of correct roles of the input profile for the execution of the document with the specified input

Parameters:
objectId - the document id
profile - the user profile
Returns:
the list of correct roles of the input profile for the execution of the document with the specified input
Throws:
it.eng.spago.error.EMFUserError
it.eng.spago.error.EMFInternalError

getPermissionFromDocumentState

public static java.lang.String getPermissionFromDocumentState(java.lang.String documentState)
Retrieves the correct permission on folder that the user must have in order to execute the document: eg: document state = REL --> permission to EXECUTION document state = DEV --> permission to DEVELOPMENT document state = TEST --> permission to TEST

Parameters:
documentState - The document state
Returns:
the permission required to execute the document

canDeleteBIObject

public static boolean canDeleteBIObject(int biobjectId,
                                        it.eng.spago.security.IEngUserProfile profile,
                                        LowFunctionality lowFunctionality)
Returns true if the user in input is able to delete the input object in the specified position (folder)

Parameters:
biobjectId - The id of the document to be deleted
profile - The user profile object
lowFunctionality - The folder
Returns:
true if the user in input is able to delete the input object in the specified position (folder)

canDeleteBIObject

public static boolean canDeleteBIObject(int biobjectId,
                                        it.eng.spago.security.IEngUserProfile profile)
Returns true if the user in input is able to delete the input object everywhere

Parameters:
biobjectId - The id of the document to be deleted
profile - The user profile object
Returns:
true if the user in input is able to delete the input object everywhere