Package org.apache.jetspeed.om.page

Examples of org.apache.jetspeed.om.page.PageSecurity


    Map model = new HashMap();
    model.put( "messages", portletConfig.getResourceBundle( request.getLocale() ) );
    model.put( "greeting", "Hello");
        boolean constraintsEnabled = pageManager.getConstraintsEnabled();
        model.put("constraintsEnabled", new Boolean(constraintsEnabled));
        PageSecurity constraints = pageManager.getPageSecurity();       
        model.put("defs", constraints.getSecurityConstraintsDefs());
        model.put("globals", constraints.getGlobalSecurityConstraintsRefs());

        PortletSession session = request.getPortletSession();
        List<Role> roles = (List<Role>) session.getAttribute(ROLES_CACHE_SESSION_ATTRIBUTE_NAME, PortletSession.PORTLET_SCOPE);
        if ( roles == null )
        {
View Full Code Here


            processFolder(folder, dest, context);

            if (context.all)
            {
                // create the root page security
                PageSecurity sourcePageSecurity = null;
                try
                {
                    sourcePageSecurity = src.getPageSecurity();
                }
                catch (DocumentNotFoundException e)
                {
                    // skip over it, not found
                }

                if (sourcePageSecurity != null)
                {
                    context.logger.info((importing?"Importing":"Exporting")+" page security");
                    PageSecurity rootSecurity = dest.copyPageSecurity(sourcePageSecurity);
                    dest.updatePageSecurity(rootSecurity);
                }
                else
                {
                    context.logger.info("Skipping page security: not found");
View Full Code Here

    /* (non-Javadoc)
     * @see org.apache.jetspeed.page.PageManager#newPageSecurity()
     */
    public PageSecurity newPageSecurity()
    {
        PageSecurity pageSecurity = null;
        try
        {
            // factory create the document and set id/path
            pageSecurity = (PageSecurity)createObject(this.pageSecurityClass);           
            pageSecurity.setPath(Folder.PATH_SEPARATOR + PageSecurity.DOCUMENT_TYPE);
        }
        catch (ClassCastException e)
        {
            String message = "Failed to create page security object for " + this.pageClass;
            log.error(message, e);
View Full Code Here

     */
    public PageSecurity copyPageSecurity(PageSecurity source)
    throws NodeException
    {
        // create the new page security document and copy attributes
        PageSecurity copy = this.newPageSecurity();
        copy.setPath(source.getPath());
        copy.setVersion(source.getVersion());       

        // copy security constraint defintions
        copy.setSecurityConstraintsDefs(DatabasePageManagerUtils.createList());               
        Iterator defs = source.getSecurityConstraintsDefs().iterator();
        while (defs.hasNext())
        {
            SecurityConstraintsDef def = (SecurityConstraintsDef)defs.next();
            SecurityConstraintsDef defCopy = this.newSecurityConstraintsDef();           
            defCopy.setName(def.getName());
            List copiedConstraints = DatabasePageManagerUtils.createList();
            Iterator constraints = def.getSecurityConstraints().iterator();
            while (constraints.hasNext())
            {
                SecurityConstraint srcConstraint = (SecurityConstraint)constraints.next();
                SecurityConstraint dstConstraint = newPageSecuritySecurityConstraint();
                copyConstraint(srcConstraint, dstConstraint);
                copiedConstraints.add(dstConstraint);
            }                                           
            defCopy.setSecurityConstraints(copiedConstraints);
            copy.getSecurityConstraintsDefs().add(defCopy);
        }
       
        // copy global security constraint references
        copy.setGlobalSecurityConstraintsRefs(DatabasePageManagerUtils.createList());
        Iterator globals = source.getGlobalSecurityConstraintsRefs().iterator();
        while (globals.hasNext())
        {
            String global = (String)globals.next();
            copy.getGlobalSecurityConstraintsRefs().add(global);
        }
       
        return copy;
    }
View Full Code Here

        {
            checkAccess(SecuredResource.VIEW_ACTION);
        }

        // get pageSecurity
        PageSecurity pageSecurity = (PageSecurity) getAllNodes().subset(PageSecurity.DOCUMENT_TYPE).get(PageSecurity.DOCUMENT_TYPE);
        if (pageSecurity == null)
        {
            throw new DocumentNotFoundException("Jetspeed PSML page security not found: " + PageSecurity.DOCUMENT_TYPE);
        }
        return pageSecurity;
View Full Code Here

     */
    public boolean checkConstraint(String securityConstraintName, String actions)
    {
        try
        {
            PageSecurity security = this.getPageSecurity();
            SecurityConstraintsDef def = security.getSecurityConstraintsDef(securityConstraintName);
            if (def != null)
            {
                return PageManagerSecurityUtils.checkConstraint(def, actions);
            }           
        }
View Full Code Here

        try
        {
            Criteria filter = new Criteria();
            filter.addEqualTo("path", path);
            QueryByCriteria query = QueryFactory.newQuery(PageSecurityImpl.class, filter);
            PageSecurity document = (PageSecurity)getPersistenceBrokerTemplate().getObjectByQuery(query);
           
            // return page or throw exception
            if (document == null)
            {
                throw new DocumentNotFoundException("Document " + path + " not found.");
            }

            // check for view access on document
            document.checkAccess(JetspeedActions.VIEW);

            return document;
        }
        catch (DocumentNotFoundException dnfe)
        {
View Full Code Here

            {
                // query for page security
                Criteria filter = new Criteria();
                filter.addEqualTo("parent", new Integer(folderImpl.getIdentity()));
                QueryByCriteria query = QueryFactory.newQuery(PageSecurityImpl.class, filter);
                PageSecurity document = (PageSecurity)getPersistenceBrokerTemplate().getObjectByQuery(query);

                // cache page security in folder
                folderImpl.resetPageSecurity((PageSecurityImpl)document, true);
            }
            catch (Exception e)
View Full Code Here

            // query for page security
            filter = new Criteria();
            filter.addEqualTo("parent", new Integer(folderImpl.getIdentity()));
            query = QueryFactory.newQuery(PageSecurityImpl.class, filter);
            PageSecurity document = (PageSecurity)getPersistenceBrokerTemplate().getObjectByQuery(query);
            if (document != null)
            {
                all.add(document);
            }
View Full Code Here

            // update page security
            filter = new Criteria();
            filter.addEqualTo("parent", new Integer(folderImpl.getIdentity()));
            query = QueryFactory.newQuery(PageSecurityImpl.class, filter);
            PageSecurity document = (PageSecurity)getPersistenceBrokerTemplate().getObjectByQuery(query);
            if (document != null)
            {
                updatePageSecurity(document);
            }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.page.PageSecurity

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.