Package org.apache.roller.weblogger.ui.core

Examples of org.apache.roller.weblogger.ui.core.RollerSession


        date = date.trim();
        ArrayList referers = new ArrayList();
        try {
            List refs =
                    mRefererMgr.getReferersToDate(mWebsite, date);
            RollerSession rses =
                    RollerSession.getRollerSession(mRequest);
           
            for (Iterator rdItr = refs.iterator(); rdItr.hasNext();) {
                WeblogReferrer referer = (WeblogReferrer) rdItr.next();
                String title =referer.getTitle();
                String excerpt = referer.getExcerpt();
                if (   StringUtils.isNotEmpty(title)
                && StringUtils.isNotEmpty(excerpt) ) {
                    if (referer.getVisible().booleanValue()
                     || referer.getWebsite().hasUserPermissions(rses.getAuthenticatedUser(), WeblogPermission.ADMIN) ) {
                        referers.add(WeblogReferrerWrapper.wrap(referer, urlStrategy));
                    }
                }
            }
           
View Full Code Here


    /** Encapsulates RefererManager **/
    public List getEntryReferers(WeblogEntryWrapper entry) {
        ArrayList referers = new ArrayList();
        try {
            List refs = mRefererMgr.getReferersToEntry(entry.getId());
            RollerSession rses =
               RollerSession.getRollerSession(mRequest);
           
            for (Iterator rdItr = refs.iterator(); rdItr.hasNext();) {
                WeblogReferrer referer = (WeblogReferrer) rdItr.next();
                String title =referer.getTitle();
                String excerpt = referer.getExcerpt();
                if (   StringUtils.isNotEmpty(title)
                && StringUtils.isNotEmpty(excerpt) ) {
                    if (referer.getVisible().booleanValue()
                    ||  referer.getWebsite().hasUserPermissions(rses.getAuthenticatedUser(), WeblogPermission.ADMIN) ) {
                        referers.add(WeblogReferrerWrapper.wrap(referer, urlStrategy));
                    }
                }
            }
           
View Full Code Here

   
    //------------------------------------------------------------------------
   
    public boolean isUserAuthorizedToEdit() {
        try {
            RollerSession rses =
                    RollerSession.getRollerSession(mRequest);
            if (rses != null && rses.getAuthenticatedUser() != null && mWebsite != null) {
                return mWebsite.hasUserPermissions(rses.getAuthenticatedUser(), WeblogPermission.AUTHOR);
            }
        } catch (Exception e) {
            mLogger.warn("PageModel.isUserAuthorizedToEdit()", e);
        }
        return false;
View Full Code Here

   
    //------------------------------------------------------------------------
   
    public boolean isUserAuthorizedToAdmin() {
        try {
            RollerSession rses =
                    RollerSession.getRollerSession(mRequest);
            if (rses != null && rses.getAuthenticatedUser() != null && mWebsite != null) {
                return mWebsite.hasUserPermissions(rses.getAuthenticatedUser(), WeblogPermission.ADMIN);
            }
        } catch (Exception e) {
            mLogger.warn("PageModel.isUserAuthorizedToAdmin()", e);
        }
        return false;
View Full Code Here

    }
   
   
    public boolean isUserAuthorizedToEdit() {
        try {
            RollerSession rses =
                    RollerSession.getRollerSession(mRequest);
            if ( rses != null && rses.getAuthenticatedUser() != null
                    && mWebsite != null) {
                return mWebsite.hasUserPermissions(
                        rses.getAuthenticatedUser(), WeblogPermission.ADMIN);
            }
        } catch (Exception e) {
            mLogger.warn("PageHelper.isUserAuthorizedToEdit)", e);
        }
        return false;
View Full Code Here

            log.debug("action is a UIAction, setting relevant attributes");
           
            UIAction theAction = (UIAction) action;
           
            // extract the authenticated user and set it
            RollerSession rses = RollerSession.getRollerSession(request);
            if(rses != null) {
                theAction.setAuthenticatedUser(rses.getAuthenticatedUser());
            }
           
            // extract the work weblog and set it
            String weblogHandle = theAction.getWeblog();
            if(!StringUtils.isEmpty(weblogHandle)) {
View Full Code Here

            log.debug("action is a UIAction, setting relevant attributes");
           
            UIAction theAction = (UIAction) action;
           
            // extract the authenticated user and set it
            RollerSession rses = RollerSession.getRollerSession(request);
            if(rses != null) {
                theAction.setAuthenticatedUser(rses.getAuthenticatedUser());
            }
           
            // extract the work weblog and set it
            String weblogHandle = theAction.getWeblog();
            if(!StringUtils.isEmpty(weblogHandle)) {
View Full Code Here

            WeblogEntryComment c = wmgr.getComment(request.getParameter("id"));
            if (c == null) {
                response.setStatus(HttpServletResponse.SC_NOT_FOUND);
            } else {
                // need post permission to view comments
                RollerSession rses = RollerSession.getRollerSession(request);
                Weblog weblog = c.getWeblogEntry().getWebsite();
                if (weblog.hasUserPermission(rses.getAuthenticatedUser(), WeblogPermission.POST)) {
                    String content = Utilities.escapeHTML(c.getContent());
                    content = WordUtils.wrap(content, 72);
                    content = StringEscapeUtils.escapeJavaScript(content);
                    String json = "{ id: \"" + c.getId() + "\"," + "content: \"" + content + "\" }";
                    response.setStatus(HttpServletResponse.SC_OK);
View Full Code Here

            WeblogEntryComment c = wmgr.getComment(request.getParameter("id"));
            if (c == null) {
                response.setStatus(HttpServletResponse.SC_NOT_FOUND);
            } else {
                // need post permission to edit comments
                RollerSession rses = RollerSession.getRollerSession(request);
                Weblog weblog = c.getWeblogEntry().getWebsite();
                if (weblog.hasUserPermission(rses.getAuthenticatedUser(), WeblogPermission.POST)) {
                    String content = Utilities.streamToString(request.getInputStream());
                    c.setContent(content);
                    // don't update the posttime when updating the comment
                    c.setPostTime(c.getPostTime());
                    wmgr.saveComment(c);
View Full Code Here

      this.request = (HttpServletRequest) context.getRequest();
    }
   
    public UserWrapper getUser() {
        try {
            RollerSession rses = RollerSession.getRollerSession(request);
            if (rses != null && rses.getAuthenticatedUser() != null) {
                return UserWrapper.wrap(rses.getAuthenticatedUser());
            }
        } catch (Exception e) {
            log.warn("ERROR: checking user authorization", e);
        }
        return null;
View Full Code Here

TOP

Related Classes of org.apache.roller.weblogger.ui.core.RollerSession

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.