Package it.eng.spago.security

Examples of it.eng.spago.security.IEngUserProfile


      LowFunctionality folder = (LowFunctionality) it.next();
      /* ********* start luca changes *************** */
      RequestContainer reqCont = ChannelUtilities.getRequestContainer(httpRequest);
      SessionContainer sessionContainer = reqCont.getSessionContainer();
      SessionContainer permanentSession = sessionContainer.getPermanentContainer();
      IEngUserProfile profile = (IEngUserProfile)permanentSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
      /*boolean isUserFunct = folder.getPath().startsWith("/"+((UserProfile)profile).getUserId());
         if(isUserFunct) {
           continue;
         }*/

 
View Full Code Here


    TracerSingleton.log(SpagoBIConstants.NAME_MODULE, TracerSingleton.DEBUG,
                    "ScriptWizardTag::doStartTag:: invoked");
    RequestContainer aRequestContainer = RequestContainer.getRequestContainer();
        SessionContainer aSessionContainer = aRequestContainer.getSessionContainer();
        SessionContainer permanentSession = aSessionContainer.getPermanentContainer();
    IEngUserProfile userProfile = (IEngUserProfile)permanentSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);

      currTheme=ThemesManager.getCurrentTheme(requestContainer);
      if(currTheme==null)currTheme=ThemesManager.getDefaultTheme();
   
    boolean isable = false;
    try {
      isable = userProfile.isAbleToExecuteAction(SpagoBIConstants.LOVS_MANAGEMENT);
    } catch (EMFInternalError e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
     if (isable){
View Full Code Here

      urlBuilder = UrlBuilderFactory.getUrlBuilder();
      msgBuilder = MessageBuilderFactory.getMessageBuilder();
      RequestContainer aRequestContainer = RequestContainer.getRequestContainer();
          SessionContainer aSessionContainer = aRequestContainer.getSessionContainer();
          SessionContainer permanentSession = aSessionContainer.getPermanentContainer();
      IEngUserProfile userProfile = (IEngUserProfile)permanentSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);

        currTheme=ThemesManager.getCurrentTheme(requestContainer);
        if(currTheme==null)currTheme=ThemesManager.getDefaultTheme();
     
      boolean isable = false;
      try {
        isable = userProfile.isAbleToExecuteAction(SpagoBIConstants.LOVS_MANAGEMENT);
      } catch (EMFInternalError e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
       if (isable){
View Full Code Here

      ModalitiesValue modVal = param.getModalityValue();
      if (modVal.getITypeCd().equals(SpagoBIConstants.INPUT_TYPE_FIX_LOV_CODE)) {
        String value = modVal.getLovProvider();
        int profileAttributeStartIndex = value.indexOf("${");
        if (profileAttributeStartIndex != -1) {
          IEngUserProfile profile = (IEngUserProfile) session.getPermanentContainer().getAttribute(
              IEngUserProfile.ENG_USER_PROFILE);
          value = StringUtilities.substituteProfileAttributesInString(value, profile,
              profileAttributeStartIndex);
          biparam.getParameter().getModalityValue().setLovProvider(value);
        }
View Full Code Here

   *
   * @throws Exception the exception
   */
  public static IEngUserProfile createNewUserProfile(String userId) throws Exception {
    logger.debug("IN");
    IEngUserProfile profile = null;
    try {
      ISecurityServiceSupplier supplier = SecurityServiceSupplierFactory.createISecurityServiceSupplier();
      SpagoBIUserProfile user = supplier.createUserProfile(userId);
      user.setFunctions(UserUtilities.readFunctionality(user.getRoles()));
      profile = new UserProfile(user);
View Full Code Here

 
  public void doService() {
   
    List viewpoints;
    ExecutionInstance executionInstance;
    IEngUserProfile userProfile;
    Integer biobjectId;
    IViewpointDAO viewpointDAO;
   
   
   
    logger.debug("IN");
   
    try{
      executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
      Assert.assertNotNull(executionInstance, "Execution instance cannot be null");
     
      userProfile = this.getUserProfile();
      Assert.assertNotNull(userProfile, "Impossible to retrive user profile");
     
      biobjectId = executionInstance.getBIObject().getId();
      Assert.assertNotNull(executionInstance, "Impossible to retrive analytical document id");
     
      logger.debug("User: [" + userProfile.getUserUniqueIdentifier() + "]");
      logger.debug("Document Id:  [" + biobjectId + "]");
     
      try {
        viewpointDAO = DAOFactory.getViewpointDAO();
        viewpoints = viewpointDAO.loadAccessibleViewpointsByObjId(biobjectId, getUserProfile());
      } catch (EMFUserError e) {
        logger.error("Cannot load viewpoints for document [" + biobjectId + "]", e);
        throw new SpagoBIServiceException(SERVICE_NAME, "Cannot load viewpoints for document [" + biobjectId + "]", e);
      }
         
      logger.debug("Document [" + biobjectId + "] have " + (viewpoints==null?"0":""+viewpoints.size() ) + " valid viewpoints for user [" + userProfile.getUserUniqueIdentifier() + "]");
     
      try {
        JSONArray viewpointsJSON = (JSONArray) SerializerFactory.getSerializer("application/json").serialize( viewpoints ,null);
        JSONObject results = new JSONObject();
        results.put("results", viewpointsJSON);
View Full Code Here

    String documentLabel;
    String executionRole;
    String userProvidedParametersStr;
   
    BIObject obj;
    IEngUserProfile profile;
    List roles;
   
    logger.debug("IN");
   
    try {
     
      profile = getUserProfile();
      documentId = requestContainsAttribute( DOCUMENT_ID )? getAttributeAsInteger( DOCUMENT_ID ): null;
      documentLabel = getAttributeAsString( DOCUMENT_LABEL );
      executionRole = getAttributeAsString( EXECUTION_ROLE );
      userProvidedParametersStr = getAttributeAsString(ObjectsTreeConstants.PARAMETERS);
     
      logger.debug("Parameter [" + DOCUMENT_ID + "] is equals to [" + documentId + "]");
      logger.debug("Parameter [" + DOCUMENT_LABEL + "] is equals to [" + documentLabel + "]");
      logger.debug("Parameter [" + EXECUTION_ROLE + "] is equals to [" + executionRole + "]");
     
      Assert.assertTrue(!StringUtilities.isEmpty( documentLabel ) || documentId != null,
          "At least one between [" + DOCUMENT_ID + "] and [" + DOCUMENT_LABEL + "] parameter must be specified on request");
     
      Assert.assertTrue(!StringUtilities.isEmpty( executionRole ), "Parameter [" + EXECUTION_ROLE + "] cannot be null");
     
      // load object to chek if it exists
      obj = null;
      if ( !StringUtilities.isEmpty( documentLabel ) ) {
        logger.debug("Loading document with label = [" + documentLabel + "] ...");
        try {
          obj = DAOFactory.getBIObjectDAO().loadBIObjectByLabel(documentLabel);
        } catch (EMFUserError error) {
          logger.error("Object with label equals to [" + documentLabel + "] not found");
          throw new SpagoBIServiceException(SERVICE_NAME, "Object with label equals to [" + documentId + "] not found", error);
        }   
      } else if ( documentId != null ) {
        logger.info("Loading biobject with id = [" + documentId + "] ...");
        try {
          obj = DAOFactory.getBIObjectDAO().loadBIObjectById(documentId);
        } catch (EMFUserError error) {
          logger.error("Object with id equals to [" + documentId + "] not found");
          throw new SpagoBIServiceException(SERVICE_NAME, "Object with id equals to [" + documentId + "] not found", error);
        }
      } else {
        Assert.assertUnreachable("At least one between [" + DOCUMENT_ID + "] and [" + DOCUMENT_LABEL + "] parameter must be specified on request");
      }
      Assert.assertNotNull(obj, "Impossible to load document");
      logger.debug("... docuemnt loaded succesfully");
     
      // retrive roles for execution
      try {
        roles = ObjectsAccessVerifier.getCorrectRolesForExecution(obj.getId(), profile);
      } catch (Throwable t) {
        throw new SpagoBIServiceException(SERVICE_NAME, t);     
      }
     
      if (roles != null && !roles.contains(executionRole)) {
        logger.error("Document [id: " + obj.getId() +"; label: " + obj.getLabel() + " ] cannot be executed by any role of the user [" + profile.getUserUniqueIdentifier() + "]");
        throw new SpagoBIServiceException(SERVICE_NAME, "Document [id: " + obj.getId() +"; label: " + obj.getLabel() + " ] cannot be executed by any role of the user [" + profile.getUserUniqueIdentifier() + "]");
      }
     
   
     
      // so far so good: everything has been validated successfully. Let's create a new ExecutionInstance.
View Full Code Here

      }
     
      //gets the profile
      SessionContainer sessionContainer = requestContainer.getSessionContainer();
      SessionContainer permanentSession = sessionContainer.getPermanentContainer();
      IEngUserProfile profile = (IEngUserProfile)permanentSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
     
      try{
        if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)){
          String operation = (String)serviceRequest.getAttribute(SpagoBIConstants.OPERATION);
          if( (operation!=null) && (operation.equals(SpagoBIConstants.FUNCTIONALITIES_OPERATION)) ) {
            pubName = "treeFunctionalities";
          } else {
            pubName = "treeAdminObjects";
          }
        }
        else if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_DEV))
          pubName = "treeDevObjects";
        else if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_USER))
          pubName = "treeExecObjects";
        else if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_TEST))
          pubName = "treeExecObjects";
        else pubName = "treeExecObjects";
      }
      catch (Exception e){
        SpagoBITracer.major(SpagoBIConstants.NAME_MODULE,
View Full Code Here

 
 
  public void doService() {
   
    ExecutionInstance executionInstance;
    IEngUserProfile userProfile;
    Integer biobjectId;
   
    String viewpointIds;
    String[] ids;
   
    IViewpointDAO viewpointDAO;
    Viewpoint viewpoint;
   
    logger.debug("IN");
   
    try {
     
      viewpointIds = this.getAttributeAsString(VIEWPOINT_IDS);
     
      logger.debug("Parameter [" + VIEWPOINT_IDS + "] is equals to [" + viewpointIds + "]");     
      Assert.assertTrue(!StringUtilities.isEmpty(viewpointIds), "Viewpoint's ids cannot be null or empty");
     
      ids = viewpointIds.split(",");
     
      executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
      Assert.assertNotNull(executionInstance, "Execution instance cannot be null");
     
      userProfile = this.getUserProfile();
      Assert.assertNotNull(userProfile, "Impossible to retrive user profile");
     
      biobjectId = executionInstance.getBIObject().getId();
      Assert.assertNotNull(executionInstance, "Impossible to retrive analytical document id");
     
      logger.debug("User: [" + userProfile.getUserUniqueIdentifier() + "]");
      logger.debug("Document Id:  [" + biobjectId + "]");
     
      /*
      Assert.assertTrue(userProfile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN),
          "User [" + userProfile.getUserUniqueIdentifier()+ "] have not the rights to delete viewpoints");
View Full Code Here

   */
  public ObjTemplate recoverBIObjTemplateDetails() throws Exception {
    // GET THE USER PROFILE
    SessionContainer session = reqCont.getSessionContainer();
    SessionContainer permanentSession = session.getPermanentContainer();     
    IEngUserProfile profile = (IEngUserProfile) permanentSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
    //String userId=(String)profile.getUserUniqueIdentifier();
    String userId=(String)((UserProfile)profile).getUserId();
      ObjTemplate templ = null;
     
    FileItem uploaded = (FileItem) request.getAttribute("UPLOADED_FILE");
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.