Package org.apache.jetspeed.om.common

Examples of org.apache.jetspeed.om.common.SecurityConstraints


                newUserFolder = pageManager.getUserFolder(userName);
            }
            else
            {
                newUserFolder = pageManager.newFolder(Folder.USER_FOLDER + userName);
                SecurityConstraints constraints = pageManager.newSecurityConstraints();
                newUserFolder.setSecurityConstraints(constraints);
                newUserFolder.getSecurityConstraints().setOwner(userName);
                pageManager.updateFolder(newUserFolder);               
            }           
            // for each role for a user, deep copy the folder contents for that role
View Full Code Here


            throw new NodeException("Destination already exists");
        }
        Folder dstFolder = pageManager.copyFolder(srcFolder, destinationPath);
        if (owner != null)
        {
            SecurityConstraints constraints = dstFolder.getSecurityConstraints();
            if (constraints == null)
            {
                constraints = pageManager.newSecurityConstraints();
                dstFolder.setSecurityConstraints(constraints);
            }
View Full Code Here

        if (!found)
        {
            dstFolder = pageManager.copyFolder(srcFolder, destinationPath);
            if (owner != null)
            {
                SecurityConstraints constraints = dstFolder.getSecurityConstraints();
                if (constraints == null)
                {
                    constraints = pageManager.newSecurityConstraints();
                    dstFolder.setSecurityConstraints(constraints);
                }
View Full Code Here

        // copy locale specific metadata
        folder.getMetadata().copyFields(source.getMetadata().getFields());
       
        // copy security constraints
        SecurityConstraints srcSecurity = source.getSecurityConstraints();       
        if ((srcSecurity != null) && !srcSecurity.isEmpty())
        {
            SecurityConstraints copiedSecurity = copySecurityConstraints(FOLDER_NODE_TYPE, srcSecurity);
            folder.setSecurityConstraints(copiedSecurity);
        }   
       
        // copy document orders
        folder.setDocumentOrder(DatabasePageManagerUtils.createList());
View Full Code Here

       
        // copy locale specific metadata
        page.getMetadata().copyFields(source.getMetadata().getFields());
       
        // copy security constraints
        SecurityConstraints srcSecurity = source.getSecurityConstraints();       
        if ((srcSecurity != null) && !srcSecurity.isEmpty())
        {
            SecurityConstraints copiedSecurity = copySecurityConstraints(PAGE_NODE_TYPE, srcSecurity);
            page.setSecurityConstraints(copiedSecurity);
        }   

        // copy menu definitions
        List menus = source.getMenuDefinitions();
View Full Code Here

        copy.setTitle(source.getTitle());
        copy.setType(source.getType());
        copy.setState(source.getState());

        // copy security constraints
        SecurityConstraints srcSecurity = source.getSecurityConstraints();       
        if ((srcSecurity != null) && !srcSecurity.isEmpty())
        {
            SecurityConstraints copiedSecurity = copySecurityConstraints(FRAGMENT_NODE_TYPE, srcSecurity);
            copy.setSecurityConstraints(copiedSecurity);
        }   
       
        // copy properties
        Iterator props = source.getProperties().entrySet().iterator();
View Full Code Here

       
        // copy locale specific metadata
        link.getMetadata().copyFields(source.getMetadata().getFields());
       
        // copy security constraints
        SecurityConstraints srcSecurity = source.getSecurityConstraints();       
        if ((srcSecurity != null) && !srcSecurity.isEmpty())
        {
            SecurityConstraints copiedSecurity = copySecurityConstraints(LINK_NODE_TYPE, srcSecurity);
            link.setSecurityConstraints(copiedSecurity);
        }   

        return link;
    }
View Full Code Here

        dstConstraint.setPermissions(srcConstraint.getPermissions());       
    }
   
    protected SecurityConstraints copySecurityConstraints(String type, SecurityConstraints source)
    {
        SecurityConstraints security = newSecurityConstraints();
        if (source.getOwner() != null)       
        {
            security.setOwner(source.getOwner());
        }
        if (source.getSecurityConstraints() != null)
        {
            List copiedConstraints = DatabasePageManagerUtils.createList();
            Iterator constraints = source.getSecurityConstraints().iterator();
            while (constraints.hasNext())
            {
                SecurityConstraint srcConstraint = (SecurityConstraint)constraints.next();
                SecurityConstraint dstConstraint = null;
                if (type.equals(PAGE_NODE_TYPE))
                {
                    dstConstraint = newPageSecurityConstraint();
                }
                else if (type.equals(FOLDER_NODE_TYPE))
                {
                    dstConstraint = newFolderSecurityConstraint();
                }
                else if (type.equals(LINK_NODE_TYPE))
                {
                    dstConstraint = newLinkSecurityConstraint();
                }
                else if (type.equals(FRAGMENT_NODE_TYPE))
                {
                    dstConstraint = newFragmentSecurityConstraint();
                }
                copyConstraint(srcConstraint, dstConstraint);
                copiedConstraints.add(dstConstraint);
            }
            security.setSecurityConstraints(copiedConstraints);
        }
        if (source.getSecurityConstraintsRefs() != null)
        {
            List copiedRefs = DatabasePageManagerUtils.createList();
            Iterator refs = source.getSecurityConstraintsRefs().iterator();
            while (refs.hasNext())
            {               
                String constraintsRef = (String)refs.next();               
                copiedRefs.add(constraintsRef);
            }
            security.setSecurityConstraintsRefs(copiedRefs);           
        }
        return security;
    }
View Full Code Here

        if (checkNodeOnly)
        {
            // check node constraints if available; otherwise,
            // recursively check parent constraints until
            // default constraints for node are checked
            SecurityConstraints constraints = getSecurityConstraints();
            if ((constraints != null) && !constraints.isEmpty())
            {
                ((SecurityConstraintsImpl)constraints).checkConstraints(actions, userPrincipals, rolePrincipals, groupPrincipals, getEffectivePageSecurity());
            }
            else if (parent != null)
            {
                ((AbstractNode)parent).checkConstraints(actions, userPrincipals, rolePrincipals, groupPrincipals, checkNodeOnly, false);
            }
        }
        else
        {
            // check node constraints if available and not
            // to be skipped due to explicity granted access
            if (!checkParentsOnly)
            {
                SecurityConstraints constraints = getSecurityConstraints();
                if ((constraints != null) && !constraints.isEmpty())
                {
                    ((SecurityConstraintsImpl)constraints).checkConstraints(actions, userPrincipals, rolePrincipals, groupPrincipals, getEffectivePageSecurity());
                }
            }
View Full Code Here

        Map properties = f.getProperties();
        properties.put(Fragment.ROW_PROPERTY_NAME, "0");
        properties.put(Fragment.COLUMN_PROPERTY_NAME, "0");
        root.getFragments().add(f);

        SecurityConstraints constraints = page.newSecurityConstraints();
        constraints.setOwner("new-user");
        List constraintsList = new ArrayList(1);
        SecurityConstraint constraint = page.newSecurityConstraint();
        constraint.setUsers(Shared.makeListFromCSV("user10,user11"));
        constraint.setRoles(Shared.makeListFromCSV("*"));
        constraint.setPermissions(Shared.makeListFromCSV(JetspeedActions.EDIT + "," + JetspeedActions.VIEW));
        constraintsList.add(constraint);
        constraints.setSecurityConstraints(constraintsList);
        List constraintsRefsList = new ArrayList(1);
        constraintsRefsList.add("public-view");
        constraints.setSecurityConstraintsRefs(constraintsRefsList);
        page.setSecurityConstraints(constraints);

        try
        {
            pageManager.updatePage(page);
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.common.SecurityConstraints

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.