Package org.apache.roller.pojos

Examples of org.apache.roller.pojos.UserData


        mLogger.debug("      Title: " + title);
       
        try {
            Roller roller = RollerFactory.getRoller();
            WeblogManager weblogMgr = roller.getWeblogManager();
            UserData user = roller.getUserManager().getUserByUsername(userid);
            Timestamp current =
                    new Timestamp(System.currentTimeMillis());
           
            WeblogEntryData entry = new WeblogEntryData();
            entry.setTitle(title);
View Full Code Here


    {
        ActionForward forward = mapping.findForward("yourProfile.page");
        try
        {
            RollerSession rollerSession = RollerSession.getRollerSession(request);
            UserData ud = rollerSession.getAuthenticatedUser();
            UserFormEx form = (UserFormEx)actionForm;
            form.copyFrom(ud, request.getLocale());
            form.setPasswordText(null);
            form.setPasswordConfirm(null);
            form.setLocale(ud.getLocale());
            form.setTimeZone(ud.getTimeZone());
            request.setAttribute("model", new BasePageModel(
                "yourProfile.title", request, response, mapping));
        }
        catch (Exception e)
        {
View Full Code Here

            ActionMessages errors = validate(form, new ActionErrors());
            if (errors.size() == 0)
            {
                // We ONLY modify the user currently logged in
                RollerSession rollerSession = RollerSession.getRollerSession(request);
                UserData data = rollerSession.getAuthenticatedUser();
               
                // We want to be VERY selective about what data gets updated
                data.setFullName(form.getFullName());
                data.setEmailAddress(form.getEmailAddress());
                data.setLocale(form.getLocale());
                data.setTimeZone(form.getTimeZone());
               
                // If user set both password and passwordConfirm then reset password
                if (    !StringUtils.isEmpty(form.getPasswordText())
                     && !StringUtils.isEmpty(form.getPasswordConfirm()))
                {
                    try
                    {
                        data.resetPassword(RollerFactory.getRoller(),
                           form.getPasswordText(),
                           form.getPasswordConfirm());
                    }
                    catch (RollerException e)
                    {
View Full Code Here

        throws IOException, ServletException
    {
        ActionForward forward = mapping.findForward("adminUser.page");
        try
        {
            UserData user = null;
            RollerRequest rreq = RollerRequest.getRollerRequest(request);
            RollerSession rollerSession = RollerSession.getRollerSession(request);
            if (rollerSession.isGlobalAdminUser() )
            {
                UserAdminForm userForm = (UserAdminForm)actionForm;
View Full Code Here

            {
                UserManager mgr = RollerFactory.getRoller().getUserManager();
                UserAdminForm userForm = (UserAdminForm)actionForm;
               
                if (userForm.isNewUser()) {
                    UserData user = new UserData();
                    userForm.copyTo(user, request.getLocale());
                    user.setId(null);
                    user.setDateCreated(new java.util.Date());
                    user.setEnabled(Boolean.TRUE);
                   
                    // Check username and email addresses
                    msgs = validate(userForm, msgs);

                    // Must have matching passwords and confirm passwords
                    if (    !StringUtils.isEmpty(userForm.getPasswordText())
                         && !StringUtils.isEmpty(userForm.getPasswordConfirm()))
                    {
                        try {
                            user.resetPassword(RollerFactory.getRoller(),
                               userForm.getPasswordText(),
                               userForm.getPasswordConfirm());
                        } catch (RollerException e) {
                            msgs.add(ActionErrors.GLOBAL_ERROR,
                            new ActionError("userSettings.passwordResetError"));
                        }
                    } else {
                        msgs.add(ActionErrors.GLOBAL_ERROR,
                            new ActionError("userSettings.needPasswordTwice"));
                    }
                   
                    // If no error messages, then add user
                    if (msgs.isEmpty()) {
                        try {
                            // Save new user to database
                            mgr.addUser(user);                           
                            RollerFactory.getRoller().flush();
                           
                            msgs.add(ActionMessages.GLOBAL_MESSAGE,
                                new ActionMessage("userSettings.saved"));
                            saveMessages(request, msgs);
                           
                            // Operation complete, return to edit action
                            userForm.setUserName(null);
                            userForm.setNewUser((false));
                           
                        } catch (RollerException e) {
                            // Add and commit failed, so show nice error message
                            msgs.add(ActionErrors.GLOBAL_ERROR,
                                new ActionError(e.getMessage()));
                            saveErrors(request, msgs);
                        }
                    } else {
                        saveErrors(request, msgs);
                    }
                    return edit(mapping, actionForm, request, response)
                   
                } else {
                   
                    UserData user = mgr.getUser(userForm.getId());
                    userForm.copyTo(user, request.getLocale());
               
                    // Check username and email addresses
                    msgs = validate(userForm, msgs);
                   
                    // If user set both password and passwordConfirm then reset
                    if (    !StringUtils.isEmpty(userForm.getPasswordText())
                         && !StringUtils.isEmpty(userForm.getPasswordConfirm()))
                    {
                        try {
                            user.resetPassword(RollerFactory.getRoller(),
                               userForm.getPasswordText(),
                               userForm.getPasswordConfirm());
                        } catch (RollerException e) {
                            msgs.add(ActionErrors.GLOBAL_ERROR,
                                new ActionMessage(
View Full Code Here

        }
    }
   
    private EntrySet getEntry() throws HandlerException {
        try {
            UserData ud = getRoller().getUserManager().getUserByUsername(getUri().getEntryId());
            if (ud == null) {
                throw new NotFoundException("ERROR: Unknown user: " + getUri().getEntryId());
            }
            UserData[] uds = new UserData[] { ud };
           
View Full Code Here

                UserEntry entry = (UserEntry)c.getEntries()[i];
                if (entry.getDateCreated() == null) {
                    // if no creation date supplied, add it
                    entry.setDateCreated(new Date());
                }
                UserData ud = toUserData(entry);
                mgr.addUser(ud);
                userDatas.add(ud);
            }
            getRoller().flush();
            return toUserEntrySet((UserData[])userDatas.toArray(new UserData[0]));
View Full Code Here

            UserManager mgr = getRoller().getUserManager();
           
            List userDatas = new ArrayList();
            for (int i = 0; i < c.getEntries().length; i++) {
                UserEntry entry = (UserEntry)c.getEntries()[i];
                UserData ud = mgr.getUserByUsername(entry.getName());
                if (ud == null) {
                    throw new NotFoundException("ERROR: Unknown user: " + entry.getName());
                }
                updateUserData(ud, entry);
               
View Full Code Here

    }
   
    private EntrySet deleteEntry() throws HandlerException {
        try {
            UserManager mgr = getRoller().getUserManager();
            UserData ud = mgr.getUserByUsername(getUri().getEntryId());
           
            if (ud == null) {
                throw new NotFoundException("ERROR: Unknown user: " + getUri().getEntryId());
            }
            // don't allow deletion of the currently authenticated user
            if (ud.getUserName().equals(getUserName())) {
                throw new NotAllowedException("ERROR: Can't delete authenticated user: " + getUserName());
            }
           
            UserData[] uds = new UserData[] { ud };
            mgr.removeUser(ud);
View Full Code Here

        }
        UserEntrySet ues = new UserEntrySet(getUrlPrefix());
       
        List entries = new ArrayList();
        for (int i = 0; i < uds.length; i++) {
            UserData ud = uds[i];
            Entry entry = toUserEntry(ud);
            entries.add(entry);
        }
        ues.setEntries((Entry[])entries.toArray(new Entry[0]));
       
View Full Code Here

TOP

Related Classes of org.apache.roller.pojos.UserData

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.