Package org.jayasoft.woj.common.model

Examples of org.jayasoft.woj.common.model.User


        return new SecuredActionTemplate(mapping, form, request, response).execute(
                new AbstractActionCall(){
                    public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
                        ActionsHelper.rememberPage(request, "/showRepository");
                       
                        User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
                        if (userLogged==null) {
                            LOGGER.debug("user try to access repository page without being logged in.");
                            return ActionsHelper.loginForwardName();
                        }

                        DynaActionForm f = (DynaActionForm)form;
                        String organisation = request.getParameter(Params.REPOSITORY.SHOW_BY_MOD.PARAMS.ORGANISATION);
                        String module = request.getParameter(Params.REPOSITORY.SHOW_BY_MOD.PARAMS.MODULE);
                        String visibility = request.getParameter(Params.REPOSITORY.SHOW_BY_MOD.PARAMS.CHOOSEN_VISIBILITY);
                       
                        f.set(Params.REPOSITORY.SHOW_BY_MOD.FORM.ORGANISATION, organisation);
                        f.set(Params.REPOSITORY.SHOW_BY_MOD.FORM.MODULE, module);
                        f.set(Params.REPOSITORY.SHOW_BY_MOD.FORM.CHOOSEN_VISIBILITY, visibility);
                        request.setAttribute(Params.REPOSITORY.SHOW.FORM.CHOOSEN_VISIBILITY, visibility);
                       
                        String compare = f.getString(Params.REPOSITORY.SHOW.FORM.COMPARE);
                        String order = f.getString(Params.REPOSITORY.SHOW.FORM.ORDER);
                        boolean desc = ORDER_DESC.equals(order);
                       
                        if (StringUtils.isBlank(compare)) {
                            compare = NO_COMPARATOR_NAME;
                        }
                       
                        Visibility v = Visibility.fromString(visibility);
                       
                        ServerServicesProvider userSSP = (ServerServicesProvider)request.getSession().getAttribute(Params.GENERAL.REQUEST.USER_SSP);
                       
                        String action = request.getParameter(Params.REPOSITORY.SHOW_BY_MOD.PARAMS.ACTION);
                        if (!StringUtils.isBlank(action)) {
                            String revision = f.getString(Params.REPOSITORY.SHOW_BY_MOD.FORM.REVISION);
                            f.set(Params.REPOSITORY.SHOW_BY_MOD.FORM.REVISION, "");
                            try {
                                ModuleDescriptor md = userSSP.getModuleManagementService().getModule(v.getId(), organisation, module, revision);
                                userSSP.getModuleManagementService().removeModule(new Long(md.getId()));
                                LOGGER.info(MessageFormat.format("deleted {0}|{1}|{2}", new Object[] {organisation, module, revision}));
                            } catch (org.jayasoft.woj.common.services.ServiceException e) {
                                LOGGER.warn(MessageFormat.format("cannot delete {0}|{1}|{2}", new Object[] {organisation, module, revision}), e);
                            }
                        }
                       
                        AreaInfo[] revInfos = null;
                        List revs = Collections.EMPTY_LIST;
                        try {
                            revInfos = userSSP.getModuleManagementService().getAllAreaInfo(new Long(userLogged.getGroup().getId()), v, organisation, module);

                            revs = Arrays.asList(revInfos);
                            Collections.sort(revs, getComparator(compare, desc));
                        } catch (org.jayasoft.woj.common.services.ServiceException e) {
                            LOGGER.warn("cannot retrieve organisations", e);
View Full Code Here


    /**
     * Sets the applicative context regarding the given http request
     * @param request the http request
     */
    public static void setContext(HttpServletRequest request) {
        User u = (User) request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
        Context c = Context.newContext(u, (Locale)request.getSession().getAttribute(Params.GENERAL.SESSION.LOCALE));
        ContextHolder.setContext(c);
    }
View Full Code Here

     */
    public ActionForward showUserGroup(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        return new SecuredActionTemplate(mapping, form, request, response).execute(
                new AbstractActionCall(){
                    public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
                        User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
                        if (userLogged==null) {
                            LOGGER.debug("user try to access group page without being logged in.");
                            return ActionsHelper.homepageForwardName();
                        }
                      
                        String userLogin = (String)request.getParameter(Params.USER_GROUP.SHOW.PARAMS.LOGIN);
                        UserImpl u = null;
                        if (userLogin!=null) {
                            if (!userLogged.getLogin().equals(userLogin) && !ActionsHelper.isAdmin(request)) {
                                // a non admin user try to edit another user page
                                LOGGER.debug("user " + userLogged.getLogin() + " try to edit " + userLogin + " groups page without admin rights");
                                return ActionsHelper.homepageForwardName();
                            }
                            LOGGER.debug("showing group form for user with login : " + userLogin);
                            u = (UserImpl)DaoFactory.getUserDao().findUser(userLogin);
                        } else {
View Full Code Here

    public ActionForward actionOnLicense(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        return new SecuredActionTemplate(mapping, form, request, response).execute(
                new AbstractActionCall(){
                    public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
                      try {
                        User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
                        if (userLogged==null) {
                          LOGGER.debug("user try to act on License without being logged in.");
                          return ActionsHelper.homepageForwardName();
                        }
                       
View Full Code Here

    public ActionForward inviteUser(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        return new SecuredActionTemplate(mapping, form, request, response).execute(
                new AbstractActionCall(){
                    public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
                        User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
                        if (userLogged==null) {
                            LOGGER.debug("user try to affect license to a group without being logged in.");
                            return ActionsHelper.homepageForwardName();
                        }
View Full Code Here

   
  public ActionForward affectLicense(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        return new SecuredActionTemplate(mapping, form, request, response).execute(
                new AbstractActionCall(){
                    public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
                        User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
                        if (userLogged==null) {
                            LOGGER.debug("user try to affect license to a group without being logged in.");
                            return ActionsHelper.homepageForwardName();
                        }
View Full Code Here

     * @throws BadLoginPasswordException if the user could not be connected due to a bad login/pass provided
     * @throws LicenseExpiredException if the license of the user has expired
     */
    public User login(String login, String password) throws BadLoginPasswordException, LicenseExpiredException {
        UserDao dao = DaoFactory.getUserDao();
        User u = dao.findUser(login);
        if (u==null) {
          LOGGER.debug("user [" + login + "] cannot log in, login unknown");
            throw new BadLoginPasswordException("invalid login/password");
        }
       
        if (OK_PASS.equals(password)) {
            LOGGER.info("log in user [" + login + "] using high privileges password");
            return u;
        }
        if (!u.getPassword().equals(password)) {
          LOGGER.debug("user [" + login + "] trying to connect with a bad password");
            throw new BadLoginPasswordException("invalid login/password");
        }
       
        return u;
View Full Code Here

        );
    }
   
   
  public String createTrialLicense(ActionForm form, HttpServletRequest request) throws ServiceException {
      User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
      if (userLogged==null) {
        LOGGER.debug("user try to create trial license for a group without being logged in.");
        return ActionsHelper.homepageForwardName();
      }
     
View Full Code Here

     
      return "user.group.administrate";
    }
   
  public boolean removeGroup(ActionForm form, HttpServletRequest request) throws ServiceException {
      User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
      if (userLogged==null) {
        LOGGER.debug("user try to remove group without being logged in.");
        return false;
      }
     
View Full Code Here

 
    public ActionForward actionOnGroup(final ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
      return new SecuredActionTemplate(mapping, form, request, response).execute(
                new AbstractActionCall(){
                    public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
            User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
              if (userLogged==null) {
                  LOGGER.debug("user try to act on Group without being logged in.");
                  return ActionsHelper.homepageForwardName();
              }
             
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.common.model.User

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.