Package org.apache.jetspeed.security.om

Examples of org.apache.jetspeed.security.om.InternalGroupPrincipal


                */
                if ( principalFullPath.compareToIgnoreCase(fullPath) == 0)
                    return principal.getRemotePrincipals();
               
                /* Expand the Group and find a match */
              InternalGroupPrincipal  groupPrincipal = getGroupPrincipals(principalFullPath);
             
              // Found Group that matches the name
              if (groupPrincipal != null)
                {
                  Collection usersInGroup = groupPrincipal.getUserPrincipals();
                  Iterator itUsers = usersInGroup.iterator();
                    while (itUsers.hasNext())
                    {
                        InternalUserPrincipal user = (InternalUserPrincipal)itUsers.next();
                        if (user.getFullPath().compareToIgnoreCase(fullPath) == 0)
View Full Code Here


    {
        // Get to the backend to return the group that matches the full path
        Criteria filter = new Criteria();
        filter.addEqualTo("fullPath", principalFullPath);
        Query query = QueryFactory.newQuery(InternalGroupPrincipalImpl.class, filter);
        InternalGroupPrincipal group = (InternalGroupPrincipal) getPersistenceBrokerTemplate().getObjectByQuery(query);
        return group;      
    }
View Full Code Here

     * @see org.apache.jetspeed.security.spi.GroupSecurityHandler#getGroupPrincipal(java.lang.String)
     */
    public GroupPrincipal getGroupPrincipal(String groupFullPathName)
    {
        GroupPrincipal groupPrincipal = null;
        InternalGroupPrincipal internalGroup = commonQueries
                .getInternalGroupPrincipal(GroupPrincipalImpl
                        .getFullPathFromPrincipalName(groupFullPathName));
        if (null != internalGroup)
        {
            groupPrincipal = new GroupPrincipalImpl(GroupPrincipalImpl
                    .getPrincipalNameFromFullPath(internalGroup.getFullPath()));
        }
        return groupPrincipal;
    }
View Full Code Here

     */
    public void setGroupPrincipal(GroupPrincipal groupPrincipal)
            throws SecurityException
    {
        String fullPath = groupPrincipal.getFullPath();
        InternalGroupPrincipal internalGroup = commonQueries.getInternalGroupPrincipal(fullPath);
        if ( null == internalGroup )
        {
            internalGroup = new InternalGroupPrincipalImpl(fullPath);
            internalGroup.setEnabled(groupPrincipal.isEnabled());
            commonQueries.setInternalGroupPrincipal(internalGroup, false);
        }
        else if ( !internalGroup.isMappingOnly() )
        {
            if ( internalGroup.isEnabled() != groupPrincipal.isEnabled() )
            {
                internalGroup.setEnabled(groupPrincipal.isEnabled());
                commonQueries.setInternalGroupPrincipal(internalGroup, false);
            }
        }
        else
        {
View Full Code Here

     * @see org.apache.jetspeed.security.spi.GroupSecurityHandler#removeGroupPrincipal(org.apache.jetspeed.security.GroupPrincipal)
     */
    public void removeGroupPrincipal(GroupPrincipal groupPrincipal)
            throws SecurityException
    {
        InternalGroupPrincipal internalGroup = commonQueries
                .getInternalGroupPrincipal(groupPrincipal.getFullPath());
        if (null != internalGroup)
        {
            commonQueries.removeInternalGroupPrincipal(internalGroup);
        }
View Full Code Here

    {
        List groupPrincipals = new LinkedList();
        Iterator result = commonQueries.getInternalGroupPrincipals(filter);
        while (result.hasNext())
        {
            InternalGroupPrincipal internalGroup = (InternalGroupPrincipal) result
                    .next();
            String path = internalGroup.getFullPath();
            if (path == null)
            {
                continue;
            }
            groupPrincipals
                    .add(new GroupPrincipalImpl(GroupPrincipalImpl
                            .getPrincipalNameFromFullPath(internalGroup
                                    .getFullPath())));
        }
        return groupPrincipals;
    }
View Full Code Here

        Preferences preferences = Preferences.userRoot().node(
                GroupPrincipalImpl.getFullPathFromPrincipalName(groupFullPathName));
        String[] fullPaths = groupHierarchyResolver.resolve(preferences);
        for (int i = 0; i < fullPaths.length; i++)
        {
            InternalGroupPrincipal internalGroup = commonQueries.getInternalGroupPrincipal(fullPaths[i]);
            if (null != internalGroup)
            {
                Collection internalRoles = internalGroup.getRolePrincipals();
                if (null != internalRoles)
                {
                    Iterator internalRolesIter = internalRoles.iterator();
                    while (internalRolesIter.hasNext())
                    {
View Full Code Here

     * @see org.apache.jetspeed.security.spi.SecurityMappingHandler#setRolePrincipalInGroup(java.lang.String,
     *      java.lang.String)
     */
    public void setRolePrincipalInGroup(String groupFullPathName, String roleFullPathName) throws SecurityException
    {
        InternalGroupPrincipal internalGroup = commonQueries.getInternalGroupPrincipal(GroupPrincipalImpl
                .getFullPathFromPrincipalName(groupFullPathName));
        if (null == internalGroup)
        {
            throw new SecurityException(SecurityException.GROUP_DOES_NOT_EXIST.create(groupFullPathName));
        }
        Collection internalRoles = internalGroup.getRolePrincipals();
        InternalRolePrincipal internalRole = commonQueries.getInternalRolePrincipal(RolePrincipalImpl
                .getFullPathFromPrincipalName(roleFullPathName));
        internalRoles.add(internalRole);
        internalGroup.setRolePrincipals(internalRoles);
        commonQueries.setInternalGroupPrincipal(internalGroup, false);
    }
View Full Code Here

     * @see org.apache.jetspeed.security.spi.SecurityMappingHandler#removeRolePrincipalInGroup(java.lang.String,
     *      java.lang.String)
     */
    public void removeRolePrincipalInGroup(String groupFullPathName, String roleFullPathName) throws SecurityException
    {
        InternalGroupPrincipal internalGroup = commonQueries.getInternalGroupPrincipal(GroupPrincipalImpl
                .getFullPathFromPrincipalName(groupFullPathName));
        if (null == internalGroup)
        {
            throw new SecurityException(SecurityException.GROUP_DOES_NOT_EXIST.create(internalGroup));
        }
        Collection internalRoles = internalGroup.getRolePrincipals();
        InternalRolePrincipal internalRole = commonQueries.getInternalRolePrincipal(RolePrincipalImpl
                .getFullPathFromPrincipalName(roleFullPathName));
        internalRoles.remove(internalRole);
        internalGroup.setRolePrincipals(internalRoles);
        commonQueries.setInternalGroupPrincipal(internalGroup, false);
    }
View Full Code Here

            if (null != internalGroups)
            {
                Iterator internalGroupsIter = internalGroups.iterator();
                while (internalGroupsIter.hasNext())
                {
                    InternalGroupPrincipal internalGroup = (InternalGroupPrincipal) internalGroupsIter.next();
                    Preferences preferences = Preferences.userRoot().node(internalGroup.getFullPath());
                    String[] fullPaths = groupHierarchyResolver.resolve(preferences);
                    for (int i = 0; i < fullPaths.length; i++)
                    {
                        groupPrincipals.add(new GroupPrincipalImpl(GroupPrincipalImpl
                                .getPrincipalNameFromFullPath(fullPaths[i])));
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.security.om.InternalGroupPrincipal

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.