Examples of PageSecurity


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

        String xml =
            "<security-constraints-def name=\"" +
                  defName +
                  "\"><security-constraint><users>*</users><permissions>view</permissions></security-constraint></security-constraints-def>";
        runTest(xml, defName, method);
        PageSecurity pageSecurity = pageManager.getPageSecurity();
        SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(defName);
        assertNotNull("definition " + defName + " not found ", def);
        SecurityConstraint constraint =  (SecurityConstraint)def.getSecurityConstraints().get(0);
        assertNotNull("first constraint for " + defName + " not found ", def);
        assertEquals("delete merge failed for constraints " + constraint.getPermissions().toString(), constraint.getPermissions().toString(), "[view]");
        assertEquals("delete merge failed for constraints " + constraint.getUsers().toString(), constraint.getUsers().toString(), "[*]");       
View Full Code Here

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

    {
        String method = "remove-def";       
        String defName = "deleteme";
        String xml = "";
        runTest(xml, defName, method);
        PageSecurity pageSecurity = pageManager.getPageSecurity();
        SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(defName);
        assertNull("definition " + defName + " should be deleted ", def);
    }
View Full Code Here

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

    {
        String method = "add-global";       
        String defName = "manager";
        String xml = "";
        runTest(xml, defName, method);
        PageSecurity pageSecurity = pageManager.getPageSecurity();
        List globals = pageSecurity.getGlobalSecurityConstraintsRefs();
        assertTrue("should have found new global " + defName,  globals.contains(defName));
        assertTrue("should have found old global " + defName,  globals.contains("admin"));
    }
View Full Code Here

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

    }

    public void testDeleteGlobal()
    throws Exception
    {
        PageSecurity pageSecurity = pageManager.getPageSecurity();       
        String method = "add-global";       
        String defName = "public-edit";
        String xml = "";       
        runTest(xml, defName, method);
        List globals = pageSecurity.getGlobalSecurityConstraintsRefs();
        assertTrue("should have found new global " + defName,  globals.contains(defName));
        method = "remove-global";       
        runTest(xml, defName, method);
        globals = pageSecurity.getGlobalSecurityConstraintsRefs();
        assertFalse("should have not found new global " + defName,  globals.contains(defName));
    }
View Full Code Here

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

        Folder fsRoot = sourceManager.getFolder(rootFolder);               
        importFolder(fsRoot);
       
       
        // create the root page security
        PageSecurity sourcePageSecurity = null;
        try
        {
            sourcePageSecurity = sourceManager.getPageSecurity();
        }
        catch (DocumentNotFoundException e)
        {
            // skip over it, not found
        }
       
        if (sourcePageSecurity != null)
        {
            PageSecurity rootSecurity = destManager.copyPageSecurity(sourcePageSecurity);       
            destManager.updatePageSecurity(rootSecurity);
        }
    }
View Full Code Here

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();
        ArrayList roles = (ArrayList)session.getAttribute(ROLES_CACHE_SESSION_ATTRIBUTE_NAME, PortletSession.PORTLET_SCOPE);
        if ( roles == null )
        {
View Full Code Here

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

    /* (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

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

    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

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

    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

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

        {
            checkAccess(JetspeedActions.VIEW);
        }

        // get pageSecurity
        PageSecurity pageSecurity = (PageSecurity) getAllNodes( false ).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
TOP
Copyright © 2018 www.massapi.com. 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.