// First case: the current user is not an administrator (so he cannot see all the functionalities)
// and the modality is Modify. In this case some functionalities, that the user cannot see, can be
// already associated to the object (by different users). This associations mustn't be erased.
if (!profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN) && mod.equalsIgnoreCase(ObjectsTreeConstants.DETAIL_MOD)) {
IBIObjectDAO objDAO = DAOFactory.getBIObjectDAO();
BIObject prevObj = objDAO.loadBIObjectById(id);
List prevFuncsId = prevObj.getFunctionalities();
for (Iterator it = prevFuncsId.iterator(); it.hasNext(); ) {
Integer funcId = (Integer) it.next();
if (!ObjectsAccessVerifier.canDev(stateCode, funcId, profile)) {
functionalities.add(funcId);