Package org.apache.jetspeed.om.common

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


    protected void insertSecurityReference(String name, String kind, Node node)
    {
        if (node.getSecurityConstraints() == null)
        {
            SecurityConstraints cons = node.newSecurityConstraints();
            node.setSecurityConstraints(cons);
        }
        if (kind.equals("Owner"))
        {
            node.getSecurityConstraints().setOwner(name);
View Full Code Here


    protected void updateSecurityReference(String name, String oldName,
            String kind, Node node)
    {
        if (node.getSecurityConstraints() == null)
        {
            SecurityConstraints cons = node.newSecurityConstraints();
            node.setSecurityConstraints(cons);
        }
        List refs = node.getSecurityConstraints().getSecurityConstraintsRefs();
        if (refs == null || refs.size() == 0)
        {
View Full Code Here

   
    private String getFolderOwner(final Folder folder)
    {
        String owner = null;
       
        SecurityConstraints constraints = folder.getSecurityConstraints();
       
        if (constraints != null)
        {
            owner = constraints.getOwner();
        }
       
        return owner;
    }
View Full Code Here

            if (fragment == null)
            {
                throw new PortletException("Cannot find fragment: " + fragmentId);
            }
           
            SecurityConstraints constraints = new TransientSecurityConstraints(fragment.getSecurityConstraints());
            SecurityConstraint constraint = new TransientSecurityConstraint(fragment.newSecurityConstraint());
            String [] rolesArray = StringUtils.split(request.getParameter("roles"), DELIMITERS);
            String [] groupsArray = StringUtils.split(request.getParameter("groups"), DELIMITERS);
            String [] usersArray = StringUtils.split(request.getParameter("users"), DELIMITERS);
           
            if (!ArrayUtils.isEmpty(rolesArray))
            {
                constraint.setRoles(Arrays.asList(rolesArray));
            }
           
            if (!ArrayUtils.isEmpty(groupsArray))
            {
                constraint.setGroups(Arrays.asList(groupsArray));
            }
           
            if (!ArrayUtils.isEmpty(usersArray))
            {
                constraint.setUsers(Arrays.asList(usersArray));
            }
           
            String [] permissionArray = StringUtils.split(StringUtils.defaultString(request.getParameter("permissions")), DELIMITERS);
           
            if (!ArrayUtils.isEmpty(permissionArray))
            {
                constraint.setPermissions(Arrays.asList(permissionArray));
            }
           
            List<SecurityConstraint> constraintList = constraints.getSecurityConstraints();
           
            if (constraintList == null)
            {
                constraintList = new ArrayList<SecurityConstraint>();
            }
           
            constraintList.add(constraint);
            constraints.setSecurityConstraints(constraintList);
           
            pageLayoutComponent.updateSecurityConstraints(fragment, constraints);
        }
        catch (Exception e)
        {
View Full Code Here

            String roles = request.getParameter("roles");
            String groups = request.getParameter("groups");
            String users = request.getParameter("users");
            String permissions = request.getParameter("permissions");
           
            SecurityConstraints constraints = new TransientSecurityConstraints(fragment.getSecurityConstraints());
           
            List<SecurityConstraint> constraintList = null;
           
            if (constraints != null)
            {
                constraintList = constraints.getSecurityConstraints();
               
                if (constraintList != null)
                {
                    for (Iterator it = constraintList.iterator(); it.hasNext(); )
                    {
                        SecurityConstraint constraint = (SecurityConstraint) it.next();
                       
                        String [] removeRoleArray = StringUtils.split(roles, DELIMITERS);
                        String [] removeGroupArray = StringUtils.split(groups, DELIMITERS);
                        String [] removeUserArray = StringUtils.split(users, DELIMITERS);
                       
                        List<String> roleList = constraint.getRoles();
                        List<String> groupList = constraint.getGroups();
                        List<String> userList = constraint.getUsers();
                       
                        if (hasEqualItems(removeRoleArray, roleList) &&
                            hasEqualItems(removeGroupArray, groupList) &&
                            hasEqualItems(removeUserArray, userList))
                        {
                            it.remove();
                            break;
                        }
                    }
                }
            }
           
            if (constraints != null && constraintList != null)
            {
                constraints.setSecurityConstraints(constraintList);
            }
           
            pageLayoutComponent.updateSecurityConstraints(fragment, constraints);
        }
        catch (Exception e)
View Full Code Here

                throw new PortletException("Cannot find fragment: " + fragmentId);
            }
           
            String [] securityConstraintRefs = request.getParameterValues("securityConstraintRef");
           
            SecurityConstraints constraints = new TransientSecurityConstraints(fragment.getSecurityConstraints());
           
            Set<String> constraintRefSet = new HashSet<String>();
           
            if (securityConstraintRefs != null)
            {
                for (int i = 0; i < securityConstraintRefs.length; i++)
                {
                    if (!"".equals(securityConstraintRefs[i]))
                    {
                        constraintRefSet.add(securityConstraintRefs[i]);
                    }
                }
            }
           
            constraints.setSecurityConstraintsRefs(constraintRefSet.isEmpty() ? null : new ArrayList<String>(constraintRefSet));
           
            pageLayoutComponent.updateSecurityConstraints(fragment, constraints);
        }
        catch (Exception e)
        {
View Full Code Here

            // update fragment preferences and page in page manager
            fragment.setSecurityConstraints(null);
            if ((constraints != null) && !constraints.isEmpty())
            {
                SecurityConstraints fragmentConstraints = fragment.newSecurityConstraints();
                String constraintsOwner = constraints.getOwner();
                if (constraintsOwner != null)
                {
                    fragmentConstraints.setOwner(constraintsOwner);
                }
                List constraintsConstraints = constraints.getSecurityConstraints();
                if ((constraintsConstraints != null) && !constraintsConstraints.isEmpty())
                {
                    List fragmentConstraintsConstraints = new ArrayList(constraintsConstraints.size());
                    Iterator constraintsIter = constraintsConstraints.iterator();
                    while (constraintsIter.hasNext())
                    {
                        SecurityConstraint constraint = (SecurityConstraint)constraintsIter.next();
                        SecurityConstraint fragmentConstraintsConstraint = fragment.newSecurityConstraint();
                        fragmentConstraintsConstraint.setGroups(constraint.getGroups());
                        fragmentConstraintsConstraint.setPermissions(constraint.getPermissions());
                        fragmentConstraintsConstraint.setRoles(constraint.getRoles());
                        fragmentConstraintsConstraint.setUsers(constraint.getUsers());
                        fragmentConstraintsConstraints.add(fragmentConstraintsConstraint);
                    }
                    fragmentConstraints.setSecurityConstraints(fragmentConstraintsConstraints);
                }
                List constraintsConstraintsRefs = constraints.getSecurityConstraintsRefs();
                if ((constraintsConstraintsRefs != null) && !constraintsConstraintsRefs.isEmpty())
                {
                    List fragmentConstraintsConstraintsRefs = new ArrayList(constraintsConstraintsRefs.size());
                    Iterator constraintsRefsIter = constraintsConstraintsRefs.iterator();
                    while (constraintsRefsIter.hasNext())
                    {
                        fragmentConstraintsConstraintsRefs.add((String)constraintsRefsIter.next());
                    }
                    fragmentConstraints.setSecurityConstraintsRefs(fragmentConstraintsConstraintsRefs);
                }
                fragment.setSecurityConstraints(fragmentConstraints);
            }
            updatePage(pageOrTemplate);
View Full Code Here

    private void setContentFragmentSecurityConstraints(ContentFragmentImpl contentFragmentImpl, BaseFragmentElement fragment)
    {
        // set content fragment attributes
        if ((contentFragmentImpl != null) && (fragment != null))
        {
            SecurityConstraints fragmentConstraints = fragment.getSecurityConstraints();
            if ((fragmentConstraints != null) && !fragmentConstraints.isEmpty())
            {
                String contentConstraintsOwner = fragmentConstraints.getOwner();
                List contentConstraintsConstraints = null;
                List fragmentConstraintsConstraints = fragmentConstraints.getSecurityConstraints();
                if ((fragmentConstraintsConstraints != null) && !fragmentConstraintsConstraints.isEmpty())
                {
                    contentConstraintsConstraints = new ArrayList(fragmentConstraintsConstraints.size());
                    Iterator constraintsIter = fragmentConstraintsConstraints.iterator();
                    while (constraintsIter.hasNext())
                    {
                        SecurityConstraint fragmentConstraint = (SecurityConstraint)constraintsIter.next();
                        contentConstraintsConstraints.add(new ContentSecurityConstraint(false, fragmentConstraint.getGroups(), fragmentConstraint.getPermissions(), fragmentConstraint.getRoles(), fragmentConstraint.getUsers()));
                    }
                }
                List contentConstraintsConstraintsRefs = null;
                List fragmentConstraintsConstraintsRefs = fragmentConstraints.getSecurityConstraintsRefs();
                if ((fragmentConstraintsConstraintsRefs != null) && !fragmentConstraintsConstraintsRefs.isEmpty())
                {
                    contentConstraintsConstraintsRefs = new ArrayList(fragmentConstraintsConstraintsRefs.size());
                    Iterator constraintsRefsIter = fragmentConstraintsConstraintsRefs.iterator();
                    while (constraintsRefsIter.hasNext())
                    {
                        contentConstraintsConstraintsRefs.add((String)constraintsRefsIter.next());
                    }
                }
                SecurityConstraints contentConstraints = new ContentSecurityConstraints(false, contentConstraintsOwner, contentConstraintsConstraints, contentConstraintsConstraintsRefs);
                contentFragmentImpl.setSecurityConstraints(contentConstraints);
            }
        }
    }
View Full Code Here

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

        // copy fragments
        BaseFragmentElement root = copyFragment(source.getRootFragment(), null, copyIds);
View Full Code Here

        copy.setSkin(source.getSkin());
        copy.setState(source.getState());
        copy.setTitle(source.getTitle());
       
        // copy security constraints
        SecurityConstraints srcSecurity = source.getSecurityConstraints();       
        if ((srcSecurity != null) && !srcSecurity.isEmpty())
        {
            SecurityConstraints copiedSecurity = copySecurityConstraints(FRAGMENT_NODE_TYPE, srcSecurity);
            copy.setSecurityConstraints(copiedSecurity);
        }
       
        // copy properties, (only properties for global and
        // current user/group/role specific values copied)
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.