Package org.opencustomer.db.vo.system

Examples of org.opencustomer.db.vo.system.UserVO


        }
    }
   
    @Override
    protected boolean isAdmin(EntityPanel panel) {
        UserVO user = (UserVO) panel.getEntity();
       
        return user.getProfile().getRole().isAdmin();
    }
View Full Code Here


        if (log.isDebugEnabled())
            log.debug("add role with ID: " + form.getId());

        try
        {
            UserVO user = (UserVO) panel.getEntity();

            RoleVO role = new RoleDAO().getById(form.getId());
           
            if(user.getProfile().getLdapGroup() == null && user.getProfile().getRole() == null || user.getProfile().getRole().isAdmin() != role.isAdmin()) {
                user.getProfile().getUsergroups().clear();
                user.getProfile().getUsergroups().add(role.getDefaultUsergroup());
                user.getProfile().setDefaultUsergroup(role.getDefaultUsergroup());
            }
           
            user.getProfile().setRole(role);
           
            if(role.isAdmin())
                user.setPerson(null);
        }
        catch (HibernateException e)
        {
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.error.invalidEntity", new Integer(form.getId())));
View Full Code Here

    }
   
    @Override
    protected final void search(EntityPanel panel, AddRoleForm form, ActionMessages errors, HttpServletRequest request, HttpServletResponse response)
    {
        UserVO activeUser = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);
        UserConfiguration conf = (UserConfiguration)request.getSession().getAttribute(Globals.CONFIGURATION_KEY);

        List<RoleVO> list = null;
        long count = 0;

        Sort sort = extractSort(panel, form, UsergroupDAO.SORT_NAME);

        Page page = new Page(conf.getIntValue(UserConfiguration.Key.LIST_NUMBER_ROWS), form.getPage());

        String paramName = form.getName();

        RoleDAO.AdminSelect adminSelect = RoleDAO.AdminSelect.NOT_ADMIN;
        if(activeUser.getProfile().getRole().isAdmin())
            adminSelect = RoleDAO.AdminSelect.ALL;
       
        RoleDAO dao = new RoleDAO();
        count = dao.countList(paramName, adminSelect, activeUser);
        if (count < page.getFirstEntry())
View Full Code Here

    private static Logger log = Logger.getLogger(SaveAction.class);

    @Override
    protected void saveEntity(EditPanel panel, ActionMessages errors, HttpServletRequest request)
    {
        UserVO user = (UserVO)panel.getEntity();

        try
        {
            new UserDAO().update(user);

            request.getSession().setAttribute(org.apache.struts.Globals.LOCALE_KEY, user.getLocale());
            request.getSession().setAttribute(Globals.USER_KEY, user);
           
            panel.setTitle(MessageUtil.message(request, "module.system.user.profile.default.title"));
           
            List<LocaleUtility.LocaleBean> locales = new ArrayList<LocaleUtility.LocaleBean>();
View Full Code Here

    private static Logger log = Logger.getLogger(SaveAction.class);

    @Override
    protected void saveEntity(EditPanel panel, ActionMessages errors, HttpServletRequest request)
    {
        UserVO activeUser = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);

        try
        {
            UserVO saveUser = (UserVO) panel.getEntity();

            HibernateContext.beginTransaction();
           
            if (saveUser.getId() == null)
            {
                if (log.isDebugEnabled())
                    log.debug("create user " + saveUser);

                if(saveUser.getLocale() == null)
                    saveUser.setLocale(activeUser.getLocale());

                new UserDAO().insert(saveUser, activeUser);

                CalendarVO calendar = new CalendarVO();
                calendar.setUser(saveUser);
                calendar.setAccessUser(EntityAccess.Access.WRITE_SYSTEM);
                calendar.setOwnerUser(saveUser.getId());
                calendar.setAccessGroup(EntityAccess.Access.NONE);
                calendar.setOwnerGroup(saveUser.getProfile().getDefaultUsergroup().getId());
                calendar.setAccessGlobal(EntityAccess.Access.WRITE_SYSTEM);
               
                new CalendarDAO().insert(calendar, activeUser);
            }
            else
View Full Code Here

    }

    @Override
    protected boolean validateData(EditPanel panel, ActionMessages errors, HttpServletRequest request)
    {
        UserVO user = (UserVO) panel.getEntity();

        if (user.getUserName() == null)
            errors.add("userName", new ActionMessage("default.error.missingInput", MessageUtil.message(request, "entity.system.user.userName")));
        else
        {
            try
            {
                UserDAO dao = new UserDAO();

                UserVO editUser = dao.getByUserName(user.getUserName());
                if (editUser != null && !editUser.getId().equals(user.getId())) {
                    if(editUser.getProfile().getRole().isAdmin())
                        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("module.system.user.manage.error.nameExistsInAdmin", MessageUtil.message(request, "entity.system.user.userName")));
                    else
                        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("module.system.user.manage.error.nameExists", MessageUtil.message(request, "entity.system.user.userName")));
                }
View Full Code Here

    private static Logger log = Logger.getLogger(LoadAction.class);

    @Override
    public EditPanel createPanel(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
    {
        UserVO activeUser = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);

        UserVO user = (UserVO)attributes.get("user");

        boolean isActiveUser = false;
        if(user.equals(activeUser))
            isActiveUser = true;  
        boolean isLdapUser =  user.getProfile().getLdapGroup() != null;
      
       
        EditPanel panel = new EditPanel(Right.ADMINISTRATION_USERMANAGEMENT_WRITE, user);
       
        if(user.getId() == null)
            panel.setTitle(MessageUtil.message(request, "module.system.user.manage.headLine.create"));
        else
        {
            panel.setTitle(MessageUtil.message(request, "module.system.user.manage.headLine.edit", user.getUserName()));

            panel.setAttribute(DeleteAction.TEXT_TITLE, MessageUtil.message(request, "module.system.user.manage.deleteUser.headLine", user.getUserName()));
            panel.setAttribute(DeleteAction.TEXT_QUESTION, MessageUtil.message(request, "module.system.user.manage.deleteUser.question", user.getUserName()));
        }
       
        panel.addAction(Action.Type.DELETE, "/system/management/user/delete", !isActiveUser&&!isLdapUser);
        panel.addAction(Action.Type.SAVE, "/system/management/user/save");
       
View Full Code Here

    }
   
    @Override
    public void createEntity(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
    {
        UserVO activeUser = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);

        UsergroupVO usergroup = new UsergroupVO();
       
        usergroup.setAccessUser(EntityAccess.Access.WRITE_SYSTEM);
        usergroup.setOwnerUser(activeUser.getId());
        usergroup.setAccessGroup(EntityAccess.Access.NONE);
        usergroup.setOwnerGroup(activeUser.getProfile().getDefaultUsergroup().getId());
        usergroup.setAccessGlobal(EntityAccess.Access.WRITE_SYSTEM);

        attributes.put("usergroup", usergroup);
        attributes.put("users", new ArrayList<UserVO>());
        attributes.put("roles", new ArrayList<RoleVO>());
View Full Code Here

    @Override
    public void loadEntity(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
    {
        try
        {
            UserVO user = new UserDAO().getById(form.getId());
            attributes.put("user", user);
           
            UserLoginLogDAO dao = new UserLoginLogDAO();
            UserLoginLogVO lastValidLogin = dao.getLastValidLoginForUser(user);
            if(lastValidLogin != null)
View Full Code Here

    }
   
    @Override
    public void createEntity(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
    {
        UserVO activeUser = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);
       
        UserVO user = new UserVO();
       
        ProfileVO profile = new ProfileVO();
        profile.setAccessUser(EntityAccess.Access.WRITE_SYSTEM);
        profile.setOwnerUser(activeUser.getId());
        profile.setAccessGroup(EntityAccess.Access.NONE);
        profile.setOwnerGroup(activeUser.getProfile().getDefaultUsergroup().getId());
        profile.setAccessGlobal(EntityAccess.Access.WRITE_SYSTEM);
        user.setProfile(profile);

        user.getProfile().setTimeLock(SystemConfiguration.getInstance().getIntValue(SystemConfiguration.Key.DEFAULT_TIMELOCK));
        user.getProfile().setIpPattern(SystemConfiguration.getInstance().getStringValue(SystemConfiguration.Key.DEFAULT_IPPATTERN));
        user.setLocale(activeUser.getLocale());
       
        user.setAccessUser(EntityAccess.Access.WRITE_SYSTEM);
        user.setOwnerUser(activeUser.getId());
        user.setAccessGroup(EntityAccess.Access.NONE);
        user.setOwnerGroup(activeUser.getProfile().getDefaultUsergroup().getId());
        user.setAccessGlobal(EntityAccess.Access.WRITE_SYSTEM);

        attributes.put("user", user);
    }
View Full Code Here

TOP

Related Classes of org.opencustomer.db.vo.system.UserVO

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.