Package it.eng.spago.security

Examples of it.eng.spago.security.IEngUserProfile


      }
     
     
      SessionContainer sessCont = getSessionContainer();
      SessionContainer permCont = sessCont.getPermanentContainer();
      IEngUserProfile profile = (IEngUserProfile)permCont.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
     
      LowFunctionality targetFunct = DAOFactory.getLowFunctionalityDAO().loadLowFunctionalityByID(new Integer(functID), false);
      isHome = "USER_FUNCT".equalsIgnoreCase( targetFunct.getCodType() );
   
      //getting children documents
      //LowFunctionality lowFunct = DAOFactory.getLowFunctionalityDAO().loadLowFunctionalityByID(functID, true);
      //objects = lowFunct.getBiObjects();
      List tmpObjects = DAOFactory.getBIObjectDAO().loadBIObjects(Integer.valueOf(functID), profile,isHome);
      objects = new ArrayList();
      if(tmpObjects != null) {
                for(Iterator it = tmpObjects.iterator(); it.hasNext();) {
                    BIObject obj = (BIObject)it.next();
                    if(ObjectsAccessVerifier.checkProfileVisibility(obj, profile))
                      objects.add(obj);
                }
      }
      HttpServletRequest httpRequest = getHttpRequest();
      MessageBuilder m = new MessageBuilder();
      Locale locale = m.getLocale(httpRequest);
      JSONArray documentsJSON = (JSONArray)SerializerFactory.getSerializer("application/json").serialize( objects ,locale);
      Collection func = profile.getFunctionalities();
     
      if(func.contains("SeeMetadataFunctionality")){
        JSONObject showmetadataAction = new JSONObject();
        showmetadataAction.put("name", "showmetadata");
        showmetadataAction.put("description", "Show Metadata");
View Full Code Here


   */
  public void service(SourceBean request, SourceBean response) throws Exception {
    RequestContainer reqCont = getRequestContainer();
    SessionContainer sessCont = reqCont.getSessionContainer();
    SessionContainer permSess = sessCont.getPermanentContainer();
    IEngUserProfile profile = (IEngUserProfile)permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);

    String idMenu = (String) request.getAttribute(DetailMenuModule.MENU_ID);
    Integer id = new Integer(idMenu);
    IMenuDAO dao=DAOFactory.getMenuDAO();
    dao.setUserProfile(profile);
View Full Code Here

      String permission_on_folder = getAttributeAsString( PERMISSION_ON_FOLDER );
      logger.debug("Parameter [" + NODE_ID + "] is equal to [" + nodeId + "]");
     
      SessionContainer sessCont = getSessionContainer();
      SessionContainer permCont = sessCont.getPermanentContainer();
      IEngUserProfile profile = (IEngUserProfile)permCont.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
     
      ILowFunctionalityDAO lfDao = DAOFactory.getLowFunctionalityDAO();
      if (nodeId.equalsIgnoreCase(ROOT_NODE_ID)) {
        //getting all I� level folders
        if(permission_on_folder!=null && permission_on_folder.equals(PERMISSION_CREATION)){
View Full Code Here

    Locale locale = MessageBuilder.getBrowserLocaleFromSpago();   

    String language=(String)serviceRequest.getAttribute("language_id");
    String country=(String)serviceRequest.getAttribute("country_id");
    logger.debug("language selected: "+language);
    IEngUserProfile profile = (IEngUserProfile)permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
    userProfile=null;
    String lang="";
    if (profile  instanceof UserProfile) {
      userProfile = (UserProfile) profile;
    }

   
   
    List<Locale> languages=GeneralUtilities.getSupportedLocales();

    if(language==null){
      logger.error("language not specified");
    }
    else{
      Iterator<Locale> iter = languages.iterator();
      boolean found=false;
      while (iter.hasNext() && found==false) {
        Locale localeTmp = iter.next();
        String lang_supported = localeTmp.getLanguage();
        String country_supported= localeTmp.getCountry();

        if(language.equalsIgnoreCase(lang_supported) && (country==null || country.equalsIgnoreCase(country_supported))){

          locale=new Locale(language,country,"");
          permSess.setAttribute("AF_LANGUAGE", locale.getLanguage());
          permSess.setAttribute("AF_COUNTRY", locale.getCountry());  

          if(userProfile!=null){
            userProfile.setAttributeValue(SpagoBIConstants.LANGUAGE, language);
            userProfile.setAttributeValue(SpagoBIConstants.COUNTRY, country);
            logger.debug("modified profile attribute to "+ lang);
          }
          else{
            logger.error("profile attribute not modified to "+ lang);       
          }
          found=true;
        }
      }
    }

    MenuUtilities.getMenuItems(serviceRequest, serviceResponse, profile);
   
    serviceResponse.setAttribute("MENU_MODE", "ALL_TOP");
    Collection functionalities = profile.getFunctionalities();
    boolean docAdmin = false;
    boolean docDev = false;
    boolean docTest = false;
    if (functionalities!=null && !functionalities.isEmpty()){
      docAdmin = functionalities.contains("DocumentAdministration")|| functionalities.contains("DocumentAdminManagement");
View Full Code Here

 
 
  private void updateDatabase(List oldCorrelations, List newCorrelations ) throws EMFUserError {
    //TODO all this operations must be performed inside a transaction
    SessionContainer permSess = getRequestContainer().getSessionContainer().getPermanentContainer();
    IEngUserProfile profile = (IEngUserProfile)permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);   
    IObjParuseDAO corrDao = DAOFactory.getObjParuseDAO();
    corrDao.setUserProfile(profile);
    Iterator iterOldCorr = oldCorrelations.iterator();
    while(iterOldCorr.hasNext()) {
      ObjParuse oldCorr = (ObjParuse)iterOldCorr.next();
View Full Code Here

   
   
    permSess.setAttribute(SpagoBIConstants.THEME, theme_name);
   

    IEngUserProfile profile = (IEngUserProfile)permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
    userProfile=null;
    if (profile  instanceof UserProfile) {
      userProfile = (UserProfile) profile;
    }
   
View Full Code Here

  public void doService() {
    logger.debug("IN on service");
    try {

      IEngUserProfile  profile = this.getUserProfile();

      String selRole = this.getAttributeAsString(SELECTED_ROLE);
      logger.debug("Selected role "+selRole);

      // check if selected role is part of the user ones
      ArrayList<String> roles = (ArrayList<String>)profile.getRoles();

      for (int i = 0; i < roles.size(); i++) {
        logger.debug("user roles "+roles.get(i));
      }     

      if(selRole.equals("")){
        selRole = null;
      }

      if(selRole!=null && !roles.contains(selRole)){
        logger.error("Security alert. Role not among the user ones");
        throw new SpagoBIServiceException(SERVICE_NAME, "Role selected is not permitted for user "+userProfile.getUserId())
      }

      // set this role as default one, or clear default role if not present
      String previousDefault = ((UserProfile)profile).getDefaultRole();
      logger.debug("previous default role "+previousDefault);
      logger.debug("new default role "+selRole);
      ((UserProfile)profile).setDefaultRole(selRole);
      logger.debug("default role set! ");

      // now I must refresh userProfile functions

      //String[] newFunctions = null;
      Collection coll = null;

      it.eng.spagobi.commons.dao.IUserFunctionalityDAO dao = DAOFactory.getUserFunctionalityDAO();

      // if new selROle is null refresh all the functionalities!
      if(selRole == null){
        logger.debug("Selected role is null, refresh all functionalities ");       
        Collection allRoles = profile.getRoles();
        String[] array = StringUtilities.convertCollectionInArray(allRoles);
        //String[] arrayFuncs = dao.readUserFunctionality(array);       
        String[] arrayFuncs = UserUtilities.readFunctionality(array);

        coll = StringUtilities.convertArrayInCollection(arrayFuncs);
View Full Code Here

   * @see it.eng.spago.dispatching.service.ServiceIFace#service(it.eng.spago.base.SourceBean, it.eng.spago.base.SourceBean)
   */
  public void service(SourceBean request, SourceBean response) throws Exception {
    logger.debug("IN");
    SessionContainer permSession = this.getRequestContainer().getSessionContainer().getPermanentContainer();
    IEngUserProfile profile = (IEngUserProfile) permSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);

    if (profile == null) {
      logger.error("Profile not found");
      throw new Exception("User profile not found");
    }

    String userId = ((UserProfile)profile).getUserId().toString();

      boolean onlyOneFunct=false;
      String objIdStr = (String)request.getAttribute(ObjectsTreeConstants.OBJECT_ID);
      logger.debug("object id "+objIdStr);
      String funcIdStr = (String)request.getAttribute(ObjectsTreeConstants.FUNCT_ID);
      logger.debug("funct id "+funcIdStr);
      if(funcIdStr==null || funcIdStr.equalsIgnoreCase("")){
        logger.error("Functionality not specified");
        throw new Exception("Functionality not specified");
      }

      //onlyOneFunct=true;
      Integer objId = new Integer(objIdStr);
      IBIObjectDAO biobjdao = DAOFactory.getBIObjectDAO();
      BIObject obj = biobjdao.loadBIObjectById(objId);
      Integer fId=Integer.decode(funcIdStr);

      // check that the functionality specified is the user one or that user is administrator

      // first case: user is administrator
      if(profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)){
        biobjdao.eraseBIObject(obj, fId);
        logger.debug("Object deleted by administrator")
      }
      else
      {
View Full Code Here

     
      ObjNote objnote = null;
     
      SessionContainer sessCont = getSessionContainer();
      SessionContainer permCont = sessCont.getPermanentContainer();
      IEngUserProfile  profile = (IEngUserProfile)permCont.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
     
      String owner = (String)((UserProfile)profile).getUserId();
      try {
        objnote = DAOFactory.getObjNoteDAO().getExecutionNotesByOwner(obj.getId(), execIdentifier, owner);
      } catch (Exception e) {
View Full Code Here

    private List getLOV(BIObjectParameter biObjectParameter, List<ObjParuse> dependencies, ExecutionInstance executionInstance){
      List rows = null;
      String lovResult = null;
      try {
        // get the result of the lov
        IEngUserProfile profile = getUserProfile();
       
        LovResultCacheManager executionCacheManager = new LovResultCacheManager();
        lovResult = executionCacheManager.getLovResult(profile, biObjectParameter, executionInstance, true);
       
        // get all the rows of the result
View Full Code Here

TOP

Related Classes of it.eng.spago.security.IEngUserProfile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.