Package evolaris.framework.um.business

Examples of evolaris.framework.um.business.UserManager


   */
  @Override
  public ActionForward enter(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp)  {
    UserEnterOrEditForm f = (UserEnterOrEditForm)form;
    ActionForward actionForward = super.enter(mapping, form, req, resp);
    UserManager userManager = new UserManager(locale,session);
    Role userRole = userManager.getRole(UserManagerBase.USER);
    f.setSelectedRoleIds(new String[]{userRole.getId()+""});
    Group currentGroup = getCurrentGroup(req);
    prepareSessionContext(req,currentGroup,false);
    return actionForward;
  }
View Full Code Here


        roleIds[i++] = role.getId() + "";
      }
      f.setSelectedRoleIds(roleIds);
    }
   
    UserManager userManager = new UserManager(locale,session);
    User user = userManager.getUserDetails(f.getId());
   
    if (user == null){
      throw new InputException(getLocalizedMessage("SystemWeb", "sys.entryNotAvailable"));
    }
   
View Full Code Here

  private void prepareSessionContext(HttpServletRequest req, Group group, boolean ownUser) {
    String formActionPath = req.getParameter("formActionPath");
    req.getSession().setAttribute("formActionPath", formActionPath);
    Role[] roles = null;
    if (req.isUserInRole(UserManagerBase.ADMINISTRATOR)) {
      UserManager userManager = new UserManager(locale,session);
      roles = userManager.getRoles();
    } else  if (req.isUserInRole(UserManagerBase.GROUP_ADMINISTRATOR) || req.isUserInRole(UserManagerBase.USER)) {
      roles = webUser.getRoles().toArray(new Role[0])// only show the own roles
    } else {
      throw new BugException("illegal role");
    }
View Full Code Here

  /**
   * @see evolaris.framework.sys.web.action.EnterEditDuplicateAction#entryFromDatabase(long)
   */
  @Override
  protected User entryFromDatabase(long id) {
    UserManager userManager = new UserManager(locale,session);
    return userManager.getUserDetails(id);
  }
View Full Code Here

      case 2: // message to user
        Long userId = f.getUserId();
        if (userId.longValue() == -1){
          throw new InputException(resources.getMessage(locale,"smssvc.MessageNotSentBecauseNoUserSelected"));
        }
        UserManager userManager = new UserManager(locale,session);
        User user = userManager.getUserDetails(userId);
        if (user == null){
          throw new ConfigurationException("illegal user id: " + user);
        }
        emailCommandEntry.setDestinationUser(user);
        emailCommandEntry.setDestinationUserSet(null);
View Full Code Here

    }
    LOGGER.debug("successfully fetched anonymous permissions.");

    LOGGER.debug("about to fetch role permissions...");
    /* role permissions */
    UserManager userMgr = new UserManager(locale,session);
    Role[] roles = null;
    if (req.isUserInRole(UserManagerBase.ADMINISTRATOR)) {
      roles = userMgr.getRoles();
    } else  if (req.isUserInRole(UserManagerBase.GROUP_ADMINISTRATOR)) {
      roles = webUser.getRoles().toArray(new Role[0])// only show the own roles
    } else {
      LOGGER.error("insufficient rights - user must be GROUP_ADMINISTRATOR or ADMINISTRATOR to edit permissions.");
      throw new InputException(getResources(req).getMessage(locale, "um.insufficientRights"));
    }   
    req.setAttribute("roles", roles);
    for (Role r : roles) {
      Set<Long> rolePermissions = permissionMgr.getRolePermissions(entry, r);   
      for (Permission p : permissions) {
        if (rolePermissions.contains(p.getId())) {
          permissionValues.add("role_"+r.getId()+"_"+p.getId());
        }       
      }
    }
    LOGGER.debug("successfully fetched role permissions.");
   
    LOGGER.debug("about to fetch userset permissions...");
    /* userset permissions */
    UserSet[] userSets = entry.getGroup().getUserSets().toArray(new UserSet[0]);
    req.setAttribute("usersets", userSets);   
    for (UserSet s : userSets) {
      Set<Long> userSetPermissions = permissionMgr.getUserSetPermissions(entry, s);   
      for (Permission p : permissions) {
        if (userSetPermissions.contains(p.getId())) {
          permissionValues.add("userset_"+s.getId()+"_"+p.getId());
        }
      }
    }
    LOGGER.debug("sucessfully fetched userset permissions.");
   
    LOGGER.debug("about to fetch user permissions.");
    /* user permissions */
    User[] users = userMgr.getUsers(entry.getGroup(), false)// get all users with a username
    if (users != null && users.length > 100) {     
      req.setAttribute("tooManyUsers", getLocalizedMessage("application", "um.tooManyUsersForPermissions", 100));
    } else {
      req.setAttribute("users", users);
      for (User u : users) {
View Full Code Here

          userPermissions.get(userId).add(permission);
        }
      }
    }
       
    UserManager userMgr = new UserManager(locale, session);
    UserSetManager userSetMgr = new UserSetManager(locale, session);
   
    permissionMgr.setAnonymousPermissions(entry, anonymousPermissions.toArray(new Long[0]));
    for (Iterator<Map.Entry<Long, Set<Long>>> iter = rolePermissions.entrySet().iterator(); iter.hasNext();) {
      Map.Entry<Long, Set<Long>> element = iter.next();
      Role role = userMgr.getRole(element.getKey());
      permissionMgr.setRolePermissions(entry, role, element.getValue().toArray(new Long[0]));
    }
    for (Iterator<Map.Entry<Long, Set<Long>>> iter = userSetPermissions.entrySet().iterator(); iter.hasNext();) {
      Map.Entry<Long, Set<Long>> element = iter.next();
      UserSet userSet = userSetMgr.getUserSet(element.getKey());
      permissionMgr.setUserSetPermissions(entry, userSet, element.getValue().toArray(new Long[0]));
    }
    for (Iterator<Map.Entry<Long, Set<Long>>> iter = userPermissions.entrySet().iterator(); iter.hasNext();) {
      Map.Entry<Long, Set<Long>> element = iter.next();
      User user = userMgr.getUserDetails(element.getKey());
      permissionMgr.setUserPermissions(entry, user, element.getValue().toArray(new Long[0]));
    }
   
    return mapping.findForward("modified");
  }
View Full Code Here

    UserSet userSet = userSetManager.getUserSet(userSetId);
    checkAccessRights(req, userSet.getGroup());
    String[] choosen = userSetAssociationListForm.getChoosen();
    Long[] userIds = userSetAssociationListForm.getUserId();   
    if (userIds != null) {
      UserManager userManager = new UserManager(locale,session);
      for (Long userId : userIds) {
        User user = userManager.getUserDetails(userId);
        checkAccessRights(req, user.getGroup());       
        if (Arrays.asList(choosen).contains(userId.toString())) {  // in list and checked
          userSet.getUsers().add(user);              // don't care if already there, as it's a set.
        } else {                          // in list and not checked
          userSet.getUsers().remove(user);            // remove from userset, don't mind if it's not there
View Full Code Here

   * @see evolaris.framework.sys.web.form.EnterEditDuplicateForm#createEntry(java.lang.Object, java.util.Locale, org.hibernate.Session)
   */
  @Override
  public void createEntry(User user, Locale locale, Session session) {
   
    UserManager userManager = new UserManager(locale,session);
    userManager.createUser(user,user.getPassword());
   
    // store new references
    Set<UserSet> newUserSets = user.getUserSets();
    UserSetManager userSetManager = new UserSetManager(locale,session);
    for (Iterator iterator = newUserSets.iterator(); iterator.hasNext();) {
View Full Code Here

  /**
   * @see evolaris.framework.sys.web.form.EnterEditDuplicateForm#deleteEntry(java.lang.Object, java.util.Locale, org.hibernate.Session, org.apache.struts.util.MessageResources)
   */
  @Override
  public void deleteEntry(User user, Locale locale, Session session, MessageResources resources) {
    UserManager userManager = new UserManager(locale,session);
    userManager.deleteUser(user);
  }
View Full Code Here

TOP

Related Classes of evolaris.framework.um.business.UserManager

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.