Package org.apache.jetspeed.om.page

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


        {
            checkAccess(JetspeedActions.VIEW);
        }

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

     * @see org.apache.jetspeed.om.page.psml.AbstractElementImpl#getEffectivePageSecurity()
     */
    public PageSecurity getEffectivePageSecurity()
    {
        // return single page security if available
        PageSecurity pageSecurity = null;
        try
        {
            pageSecurity = getPageSecurity(false);
            if (pageSecurity != null)
            {
View Full Code Here

        Folder fsRoot = sourceManager.getFolder(rootFolder);               
        Folder root = 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

    {
        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

    }

    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

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

    {
        // reset page manager cache
        pageManager.reset();
       
        // update documents and folders in persisted store
        PageSecurity pageSecurity = pageManager.getPageSecurity();
        assertEquals("/page.security", pageSecurity.getPath());
        pageSecurity.getGlobalSecurityConstraintsRefs().add("UPDATED");
        pageManager.updatePageSecurity(pageSecurity);

        Page page = pageManager.getPage("/default-page.psml");
        assertEquals("/default-page.psml", page.getPath());
        page.setTitle("UPDATED");
View Full Code Here

            {
                // query for page security
                Criteria filter = new Criteria();
                filter.addEqualTo("parent", folderImpl.getId());
                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

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.