Package org.apache.jetspeed.om.page

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


        {
            constraintsDefsMap = new HashMap((constraintsDefsList.size() * 2) + 1);
            Iterator definitionsIter = constraintsDefsList.iterator();
            while (definitionsIter.hasNext())
            {
                SecurityConstraintsDef definition = (SecurityConstraintsDef)definitionsIter.next();
                constraintsDefsMap.put(definition.getName(), definition);
            }
        }
        if (constraintsDefsMap != null)
        {
            return (SecurityConstraintsDef) constraintsDefsMap.get(name);
View Full Code Here


                        folder.setSecurityConstraints(constraints);
                        pageManager.updateFolder(folder);
                       
                        PageSecurity pageSecurity = pageManager.newPageSecurity();
                        List constraintsDefs = new ArrayList(2);
                        SecurityConstraintsDef constraintsDef = pageManager.newSecurityConstraintsDef();
                        constraintsDef.setName("public-view");
                        List defConstraints = new ArrayList(1);
                        SecurityConstraint defConstraint = pageManager.newPageSecuritySecurityConstraint();
                        defConstraint.setUsers(Shared.makeListFromCSV("*"));
                        defConstraint.setPermissions(Shared.makeListFromCSV("view"));
                        defConstraints.add(defConstraint);
                        constraintsDef.setSecurityConstraints(defConstraints);
                        constraintsDefs.add(constraintsDef);
                        constraintsDef = pageManager.newSecurityConstraintsDef();
                        constraintsDef.setName("admin-all");
                        defConstraints = new ArrayList(1);
                        defConstraint = pageManager.newPageSecuritySecurityConstraint();
                        defConstraint.setRoles(Shared.makeListFromCSV("admin"));
                        defConstraint.setPermissions(Shared.makeListFromCSV("view,edit"));
                        defConstraints.add(defConstraint);
                        constraintsDef.setSecurityConstraints(defConstraints);
                        constraintsDefs.add(constraintsDef);
                        pageSecurity.setSecurityConstraintsDefs(constraintsDefs);
                        List globalConstraintsRefs = new ArrayList(1);
                        globalConstraintsRefs.add("admin-all");
                        pageSecurity.setGlobalSecurityConstraintsRefs(globalConstraintsRefs);
View Full Code Here

                // dereference each security constraints definition
                Iterator constraintsRefsIter = constraintsRefs.iterator();
                while (constraintsRefsIter.hasNext())
                {
                    String constraintsRef = (String)constraintsRefsIter.next();
                    SecurityConstraintsDef securityConstraintsDef = pageSecurity.getSecurityConstraintsDef(constraintsRef);
                    if ((securityConstraintsDef != null) && (securityConstraintsDef.getSecurityConstraints() != null))
                    {
                        if (constraints == null)
                        {
                            constraints = new ArrayList(constraintsRefs.size());
                        }
                        constraints.addAll(securityConstraintsDef.getSecurityConstraints());
                    }
                    else
                    {
                        log.error("dereferenceSecurityConstraintsRefs(): Unable to dereference \"" + constraintsRef + "\" security constraints definition.");
                    }
View Full Code Here

        // copy security constraint defintions
        copy.setSecurityConstraintsDefs(new ArrayList());               
        Iterator defs = source.getSecurityConstraintsDefs().iterator();
        while (defs.hasNext())
        {
            SecurityConstraintsDef def = (SecurityConstraintsDef)defs.next();
            SecurityConstraintsDef defCopy = this.newSecurityConstraintsDef();           
            defCopy.setName(def.getName());
            List copiedConstraints = new ArrayList();
            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(new ArrayList());
View Full Code Here

            // dereference each security constraints definition
            Iterator constraintsRefsIter = constraintsRefs.iterator();
            while (constraintsRefsIter.hasNext())
            {
                String constraintsRef = (String)constraintsRefsIter.next();
                SecurityConstraintsDef securityConstraintsDef = pageSecurity.getSecurityConstraintsDef(constraintsRef);
                if ((securityConstraintsDef != null) && (securityConstraintsDef.getSecurityConstraints() != null))
                {
                    if (constraints == null)
                    {
                        constraints = new ArrayList(constraintsRefs.size());
                    }
                    constraints.addAll(securityConstraintsDef.getSecurityConstraints());
                }
            }
        }
        return constraints;
    }
View Full Code Here

        {
            securityConstraintsDefsMap = new HashMap((getSecurityConstraintsDefs().size() * 2) + 1);
            Iterator definitionsIter = getSecurityConstraintsDefs().iterator();
            while (definitionsIter.hasNext())
            {
                SecurityConstraintsDef definition = (SecurityConstraintsDef)definitionsIter.next();
                String definitionName = definition.getName();
                if (!securityConstraintsDefsMap.containsKey(definitionName))
                {
                    securityConstraintsDefsMap.put(definitionName, definition);
                }
            }
View Full Code Here

        assertNotNull(folder.getLinks());
        assertEquals(1, folder.getLinks().size());

        PageSecurity pageSecurity = pageManager.newPageSecurity();
        List constraintsDefs = new ArrayList(2);
        SecurityConstraintsDef constraintsDef = pageManager.newSecurityConstraintsDef();
        constraintsDef.setName("public-view");
        List defConstraints = new ArrayList(1);
        SecurityConstraint defConstraint = pageSecurity.newSecurityConstraint();
        defConstraint.setUsers(Shared.makeListFromCSV("*"));
        defConstraint.setPermissions(Shared.makeListFromCSV("view"));
        defConstraints.add(defConstraint);
        constraintsDef.setSecurityConstraints(defConstraints);
        constraintsDefs.add(constraintsDef);
        constraintsDef = pageSecurity.newSecurityConstraintsDef();
        constraintsDef.setName("admin-all");
        defConstraints = new ArrayList(2);
        defConstraint = pageSecurity.newSecurityConstraint();
        defConstraint.setRoles(Shared.makeListFromCSV("admin"));
        defConstraint.setPermissions(Shared.makeListFromCSV("view,edit"));
        defConstraints.add(defConstraint);
        defConstraint = pageSecurity.newSecurityConstraint();
        defConstraint.setRoles(Shared.makeListFromCSV("nobody"));
        defConstraints.add(defConstraint);
        constraintsDef.setSecurityConstraints(defConstraints);
        constraintsDefs.add(constraintsDef);
        pageSecurity.setSecurityConstraintsDefs(constraintsDefs);
        List globalConstraintsRefs = new ArrayList(2);
        globalConstraintsRefs.add("admin-all");
        globalConstraintsRefs.add("public-view");
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

            throw new AJAXException("Missing 'name' parameter");
       
        try
        {
            PageSecurity pageSecurity = pageManager.getPageSecurity();       
            SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(name);
            if (def == null)
            {
                return 0;
            }
            List defs = pageSecurity.getSecurityConstraintsDefs();
View Full Code Here

            Document document = builder.parse(new ByteArrayInputStream(bytes));
           
            Element root = document.getDocumentElement();
            String name = root.getAttribute("name");
            PageSecurity pageSecurity = pageManager.getPageSecurity();
            SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(name);
            int defsSize = 0;
            if (def == null)
            {
                def = pageManager.newSecurityConstraintsDef();
                def.setName(name);
                added = true;
            }
            NodeList xmlConstraints = root.getElementsByTagName("security-constraint");
            int xmlSize = xmlConstraints.getLength();
            if (added == false)
            {
                defsSize = def.getSecurityConstraints().size();
            }
            int min = (xmlSize < defsSize) ? xmlSize : defsSize;
            List constraints = def.getSecurityConstraints();
            NodeList owners = root.getElementsByTagName("owner");
            if (owners.getLength() == 1)
            {
            }
            for (int ix = 0; ix < min; ix++)
View Full Code Here

TOP

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

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.