Package org.jmanage.webui.forms

Examples of org.jmanage.webui.forms.UserForm


     *
     * @param form
     * @param user
     */
    private void prepareUserForm(ActionForm form, User user){
        UserForm userForm = (UserForm)form;
        userForm.setUsername(user.getUsername());
        userForm.setPassword(UserForm.FORM_PASSWORD);
        userForm.setConfirmPassword(UserForm.FORM_PASSWORD);
        //TODO Need to handle multiple role scenario
        if(!AuthConstants.USER_ADMIN.equals(user.getUsername())){
          String[] roles = new String[user.getRoles().size()];
          int ctr = 0;
          for(Iterator it= user.getRoles().iterator(); it.hasNext();){
            roles[ctr++] = ((Role)it.next()).getName();
          }
            userForm.setRole(roles);
        }
        userForm.setStatus(user.getStatus());
    }
View Full Code Here


     *
     * @param form
     * @return
     */
    private User buildUser(ActionForm form){
        UserForm userForm = (UserForm)form;
        List<Role> roles = new ArrayList<Role>(1);
        String[] rolesString = userForm.getRole();
        for(int ctr=0; ctr < rolesString.length; ctr++){
          roles.add(new Role(rolesString[ctr]));
        }
        User user = new User(userForm.getUsername(), Crypto.hash(userForm.getPassword()),
                roles, userForm.getStatus(), 0);
        return user;
    }
View Full Code Here

     *
     * @param form
     * @return
     */
    private User buildUser(ActionForm form){
        UserForm userForm = (UserForm)form;
        User user = UserManager.getInstance().getUser(userForm.getUsername());
        assert user != null;

        List<Role> roles = new ArrayList<Role>(1);
        String[] rolesString = userForm.getRole();
        for(int ctr=0; ctr < rolesString.length; ctr++){
          roles.add(new Role(rolesString[ctr]));
        }
        user.setRoles(roles);
        if(!userForm.getPassword().equals(UserForm.FORM_PASSWORD)){
            String hashedPassword = Crypto.hash(userForm.getPassword());
            user.setPassword(hashedPassword);
        }
        user.setStatus(userForm.getStatus());
        return user;
    }
View Full Code Here

TOP

Related Classes of org.jmanage.webui.forms.UserForm

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.