Package org.jayasoft.woj.common.model

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


                new AbstractActionCall(){
                    public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
                        ActionsHelper.rememberPage(request, "/user/license/show");
                        ActionsHelper.rememberContext(request, "admin");
                       
                        User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
                        if (userLogged==null) {
                            LOGGER.debug("user try to access license page without being logged in.");
                            return ActionsHelper.loginForwardName();
                        }
                        String userLogin = (String)request.getParameter(Params.USER_LICENSE.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 + " license page without admin rights");
                                return ActionsHelper.homepageForwardName();
                            }
                            LOGGER.debug("showing license form for user with login : " + userLogin);
                            u = (UserImpl)DaoFactory.getUserDao().findUser(userLogin);
                        } else {
View Full Code Here


                new AbstractActionCall(){
                    public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
                        ActionsHelper.rememberPage(request, "/user/license/show");
                        ActionsHelper.rememberContext(request, "admin");
                       
                        User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
                        if (userLogged==null) {
                            LOGGER.debug("user try to access license page without being logged in.");
                            return ActionsHelper.loginForwardName();
                        }
                        String userLogin = (String)request.getParameter(Params.USER_LICENSE.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 + " license page without admin rights");
                                return ActionsHelper.homepageForwardName();
                            }
                            LOGGER.debug("showing license form for user with login : " + userLogin);
                            u = (UserImpl)DaoFactory.getUserDao().findUser(userLogin);
                        } else {
View Full Code Here

                new AbstractActionCall(){
                    public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
                        ActionsHelper.rememberPage(request, "/user/license/show");
                        ActionsHelper.rememberContext(request, "admin");
                       
                        User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
                        if (userLogged==null) {
                            LOGGER.debug("user try to access license page without being logged in.");
                            return ActionsHelper.loginForwardName();
                        }
                       
View Full Code Here

                    request.removeAttribute(Params.LOGIN.REQUEST.ERROR);
                    String login = (String)request.getParameter(Params.LOGIN.PARAMS.LOGIN);
                    String password = (String)request.getParameter(Params.LOGIN.PARAMS.PASSWORD);
                    LOGGER.debug(MessageFormat.format("user[{0}:{1}] is logging", new Object[]{login, password}));
                    try {
                      User u = LoginService.getInstance().login(login, password!=null?password.toUpperCase():"");
                      LOGGER.debug(MessageFormat.format("user[{0}] has successfuly be logged in", new Object[]{login}));
                      request.getSession().setAttribute(Params.LOGIN.SESSION.USER, u);
                            ActionsHelper.rememberPage(request, "/account/admin/show");
                    } catch (BadLoginPasswordException e) {
                      LOGGER.debug(MessageFormat.format("user[{0}] could not be logged", new Object[]{login}));
View Full Code Here

    public ActionForward logout(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        // TODO enregistrer en base les infos sur le temps de connection, ....
        ActionsHelper.rememberPage(request, "/homepage");
        ActionsHelper.rememberContext(request, "homepage");

        User u = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
        if (u==null) {
            LOGGER.warn("no user in session to log out");
        } else {
            LOGGER.debug("user " + u.getLogin() + " is logging out");
        }
       
        // We remove the user from the session
        request.getSession().removeAttribute(Params.LOGIN.SESSION.USER);
       
View Full Code Here

                new AbstractActionCall() {
                    public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
                        ActionsHelper.rememberPage(request, "/user/invoice/showInvoices");
                        ActionsHelper.rememberContext(request, "admin");

                        User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
                        if (userLogged==null) {
                            LOGGER.debug("user try to access license page without being logged in.");
                            return ActionsHelper.loginForwardName();
                        }
                       
                        String userLogin = (String)request.getParameter(Params.USER_INVOICE.SHOW.PARAMS.LOGIN);
                        User 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 + " license page without admin rights");
                                return ActionsHelper.homepageForwardName();
                            }
                            LOGGER.debug("showing license form for user with login : " + userLogin);
                            u = DaoFactory.getUserDao().findUser(userLogin);
                        } else {
                            LOGGER.debug("showing license form for connected user");
                            u = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
                            if (u!=null) {
                                // We refresh the user
                                u = Portal.getInstance().getUserService().getUser(u.getLogin());
                                if (u!=null) {
                                    request.getSession().setAttribute(Params.LOGIN.SESSION.USER, u);
                                }
                            }
                        }
                       
                        if (u == null) {
                            LOGGER.debug("failed to retrieve user to modify in license form");
                            request.setAttribute(Params.REDIRECT.REQUEST.REDIRECTION_URL, ActionsHelper.homepageForward().getPath());
                            request.setAttribute(Params.REDIRECT.REQUEST.MESSAGE_KEY, "illegal.state");
                            return "redirect";
                        }
                       
                        request.setAttribute(Params.USER_INVOICE.SHOW.REQUEST.USER_LOGIN, u.getLogin());
                        request.setAttribute(Params.USER_INVOICE.SHOW.REQUEST.USER, u);
                        List orders = ServiceFactory.getCommercialService().getOrders(u);
                        request.setAttribute(Params.USER_INVOICE.SHOW.REQUEST.ORDERS, orders);
                       
                        return null;
View Full Code Here

                new AbstractActionCall(){
                    public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
                        ActionsHelper.rememberPage(request, "/account/admin/show");
                        ActionsHelper.rememberContext(request, "admin");

                        User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
                        if (userLogged==null) {
                            LOGGER.debug("user try to access account page without being logged in.");
                            return ActionsHelper.loginForwardName();
                        }
                        License l = ServiceFactory.getLicenseService().getLicenseUsed(userLogged);
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.