Package org.jayasoft.woj.common.model

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


 
    public ActionForward unLink(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


                            addWOJMessages(request, RessourceBundleApplicationMessage.error("edition.group-form.error.name.fields.required", null));
                            return "user.group.administrate";
                        }

                       
                        User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
                        Group grp;
                        if (grpId != null) {
                          try {
                            grp = (Group) DaoFactory.getGroupDao().find(grpId);
                          } catch (DaoException e) {
View Full Code Here

    }

    private String administrateGroup(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
      String grpId = null;
      try {
        User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
        grpId = (String)request.getParameter(Params.USER_GROUP.EDIT.PARAMS.GROUP_ID);
        Group editedGroup = null;
        if (grpId!=null) {
          editedGroup = (Group) DaoFactory.getGroupDao().find(new Long(Long.parseLong(grpId)));
          if (editedGroup == null) {
            // No group found
                    LOGGER.debug("failed to retrieve user to modify in group form");
            request.setAttribute(Params.REDIRECT.REQUEST.REDIRECTION_URL, ActionsHelper.homepageForward().getPath());
            request.setAttribute(Params.REDIRECT.REQUEST.MESSAGE_KEY, "illegal.state");
            return "redirect";
          }
          LOGGER.debug("editing group : " + editedGroup);
            Collection admins = Arrays.asList(ServiceFactory.getUserService().getAdministratorsOfGroup(editedGroup));
            Collection adminIds = CollectionUtils.collect(admins, new Transformer() {public Object transform(Object input) {return String.valueOf(((UserImpl)input).getId());};});
            if (! adminIds.contains(String.valueOf(userLogged.getId()))) {
              // a user try to edit a group without the right
              LOGGER.debug("user " + userLogged.getLogin() + " try to edit " + editedGroup + " group without admin rights");
              return ActionsHelper.homepageForwardName();
            }
            request.setAttribute(Params.USER_GROUP.SHOW.REQUEST.USER, userLogged);
            prepareValueForAdministration(form, request, userLogged, editedGroup);
        } else {
View Full Code Here

public class SynchronisationService {
    public User[] getUsers(Long since) {
        User[] foundUsers = DaoFactory.getUserDao().findUpdatedUsers(since);
        User[] uSend = new User[foundUsers.length];
        for (int i = 0; i < foundUsers.length; i++) {
             uSend[i] = new User();
             BeanHelper.copy(foundUsers[i], uSend[i], User.class);
             if (foundUsers[i].getGroup() != null) {
                 Group g = new Group();
                 BeanHelper.copy(foundUsers[i].getGroup(), g, Group.class);
                 uSend[i].setGroup(g);
View Full Code Here

    Collection grpLicenses = ServiceFactory.getLicenseService().getLicensesInGroup(editedGroup);
    Collection freeGrpLicenses = new ArrayList();
    Collection grpMembers = new ArrayList();
    for (Iterator it = grpLicenses.iterator(); it.hasNext(); ) {
      License l = (License) it.next();
      User owner = ServiceFactory.getLicenseService().getOwner(l);
      if (owner == null) {
        freeGrpLicenses.add(l);
      } else {
        grpMembers.add(owner);
      }
View Full Code Here

    public void addUser(User u) throws RegistrationException {
        // We ensure that we save a correct user implementation
        UserImpl userToSave = (UserImpl)_uDao.newHandledObject();
        BeanHelper.copy(u, userToSave, User.class);
       
        User usr = _uDao.findUser(u.getLogin());
       
        if (usr!=null) {
            // a user already exists with the same login
            throw new LoginExistsException("login already exists");
        }
View Full Code Here

    User[] uSend = DaoFactory.getUserDao().findAdministratorsOfGroup(group);
    return uSend;
  }

  public User getUser(String stUserLogin) {
    User uSend = DaoFactory.getUserDao().findUser(stUserLogin);
        return uSend;
  }
View Full Code Here

    User uSend = DaoFactory.getUserDao().findUser(stUserLogin);
        return uSend;
  }

    public User getUserByEmail(String email) {
        User uSend = DaoFactory.getUserDao().findUserByEmail(email);
        return uSend;
    }
View Full Code Here

            DaoFactory.getUserDao().delete(userIds);
            if(userIds != null) {
              List usersList = new ArrayList();
              for (Iterator iter = userIds.iterator(); iter.hasNext();) {
                Long id = (Long) iter.next();
          User user = new User();
          user.setId(id.longValue());
          usersList.add(user);
        }
              NotificationService.deleteUsers((User[]) usersList.toArray(new User[usersList.size()]));
            }
            LOGGER.info("delete done.");
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

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.