Examples of InternalUserPrincipal


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

     */
    public void removeUserPrincipalInRole(String username, String roleFullPathName) throws SecurityException
    {
        boolean isMappingOnly = false;
        // Check is the record is used for mapping only.
        InternalUserPrincipal internalUser = commonQueries.getInternalUserPrincipal(username, false);
        if (null == internalUser)
        {
            internalUser = commonQueries.getInternalUserPrincipal(username, true);
            isMappingOnly = true;
        }
        if (null != internalUser)
        {
            Collection internalRoles = internalUser.getRolePrincipals();
            // This should not be null. Check for null should be made by the caller.
            InternalRolePrincipal internalRole = commonQueries.getInternalRolePrincipal(RolePrincipalImpl
                    .getFullPathFromPrincipalName(roleFullPathName));
            // Check anyway.
            if (null == internalRole)
            {
                throw new SecurityException(SecurityException.ROLE_DOES_NOT_EXIST.create(roleFullPathName));
            }
            internalRoles.remove(internalRole);
            // Remove dead mapping records. I.e. No mapping is associated with the specific record.
            if (isMappingOnly && internalRoles.isEmpty() && internalUser.getGroupPrincipals().isEmpty()
                    && internalUser.getPermissions().isEmpty())
            {
                commonQueries.removeInternalUserPrincipal(internalUser);
            }
            else
            {
                internalUser.setRolePrincipals(internalRoles);
                commonQueries.setInternalUserPrincipal(internalUser, isMappingOnly);
            }
        }
        else
        {
View Full Code Here

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

     * @see org.apache.jetspeed.security.spi.SecurityMappingHandler#getGroupPrincipals(java.lang.String)
     */
    public Set getGroupPrincipals(String username)
    {
        Set groupPrincipals = new HashSet();
        InternalUserPrincipal internalUser = commonQueries.getInternalUserPrincipal(username);
        if (null != internalUser)
        {
            Collection internalGroups = internalUser.getGroupPrincipals();
            if (null != internalGroups)
            {
                Iterator internalGroupsIter = internalGroups.iterator();
                while (internalGroupsIter.hasNext())
                {
View Full Code Here

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

                if (null != internalUsers)
                {
                    Iterator internalUsersIter = internalUsers.iterator();
                    while (internalUsersIter.hasNext())
                    {
                        InternalUserPrincipal internalUser = (InternalUserPrincipal) internalUsersIter.next();
                        Principal userPrincipal = new UserPrincipalImpl(UserPrincipalImpl
                                .getPrincipalNameFromFullPath(internalUser.getFullPath()));
                        if (!userPrincipals.contains(userPrincipal))
                        {
                            userPrincipals.add(userPrincipal);
                        }
                    }
View Full Code Here

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

                if (null != internalUsers)
                {
                    Iterator internalUsersIter = internalUsers.iterator();
                    while (internalUsersIter.hasNext())
                    {
                        InternalUserPrincipal internalUser = (InternalUserPrincipal) internalUsersIter.next();
                        Principal userPrincipal = new UserPrincipalImpl(UserPrincipalImpl
                                .getPrincipalNameFromFullPath(internalUser.getFullPath()));
                        if (!userPrincipals.contains(userPrincipal))
                        {
                            userPrincipals.add(userPrincipal);
                        }
                    }
View Full Code Here

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

     * @see org.apache.jetspeed.security.spi.SecurityMappingHandler#setUserPrincipalInGroup(java.lang.String,
     *      java.lang.String)
     */
    public void setUserPrincipalInGroup(String username, String groupFullPathName) throws SecurityException
    {
        InternalUserPrincipal internalUser = commonQueries.getInternalUserPrincipal(username);
        boolean isMappingOnly = false;
        if (null == internalUser)
        {
            // This is a record for mapping only.
            isMappingOnly = true;
            internalUser = new InternalUserPrincipalImpl(UserPrincipalImpl.getFullPathFromPrincipalName(username));
        }
        Collection internalGroups = internalUser.getGroupPrincipals();
        // This should not be null. Check for null should be made by the caller.
        InternalGroupPrincipal internalGroup = commonQueries.getInternalGroupPrincipal(GroupPrincipalImpl
                .getFullPathFromPrincipalName(groupFullPathName));
        // Check anyway.
        if (null == internalGroup)
        {
            throw new SecurityException(SecurityException.GROUP_DOES_NOT_EXIST.create(groupFullPathName));
        }
        internalGroups.add(internalGroup);
        internalUser.setGroupPrincipals(internalGroups);
        commonQueries.setInternalUserPrincipal(internalUser, isMappingOnly);
    }
View Full Code Here

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

     */
    public void removeUserPrincipalInGroup(String username, String groupFullPathName) throws SecurityException
    {
        boolean isMappingOnly = false;
        // Check is the record is used for mapping only.
        InternalUserPrincipal internalUser = commonQueries.getInternalUserPrincipal(username, false);
        if (null == internalUser)
        {
            internalUser = commonQueries.getInternalUserPrincipal(username, true);
            isMappingOnly = true;
        }
        if (null != internalUser)
        {
            Collection internalGroups = internalUser.getGroupPrincipals();
            // This should not be null. Check for null should be made by the caller.
            InternalGroupPrincipal internalGroup = commonQueries.getInternalGroupPrincipal(GroupPrincipalImpl
                    .getFullPathFromPrincipalName(groupFullPathName));
            // Check anyway.
            if (null == internalGroup)
            {
                throw new SecurityException(SecurityException.GROUP_DOES_NOT_EXIST.create(groupFullPathName));
            }
            internalGroups.remove(internalGroup);
            // Remove dead mapping records. I.e. No mapping is associated with the specific record.
            if (isMappingOnly && internalGroups.isEmpty() && internalUser.getRolePrincipals().isEmpty()
                    && internalUser.getPermissions().isEmpty())
            {
                commonQueries.removeInternalUserPrincipal(internalUser);
            }
            else
            {
            internalUser.setGroupPrincipals(internalGroups);
            commonQueries.setInternalUserPrincipal(internalUser, isMappingOnly);
            }
        }
        else
        {
View Full Code Here

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

        String fullPath = userPrincipal.getFullPath();
        // Get user.
        Criteria filter = new Criteria();
        filter.addEqualTo("fullPath", fullPath);
        Query query = QueryFactory.newQuery(InternalUserPrincipalImpl.class, filter);
        InternalUserPrincipal internalUser = (InternalUserPrincipal) getPersistenceBrokerTemplate().getObjectByQuery(query);
        return internalUser;
    }
View Full Code Here

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

        // Get user.
        Criteria filter = new Criteria();
        filter.addEqualTo("fullPath", fullPath);
        filter.addEqualTo("isMappingOnly", new Boolean(isMappingOnly));
        Query query = QueryFactory.newQuery(InternalUserPrincipalImpl.class, filter);
        InternalUserPrincipal internalUser = (InternalUserPrincipal) getPersistenceBrokerTemplate().getObjectByQuery(query);
        return internalUser;
    }
View Full Code Here

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

     * @see org.apache.jetspeed.security.spi.SecurityMappingHandler#getRolePrincipals(java.lang.String)
     */
    public Set getRolePrincipals(String username)
    {
        Set rolePrincipals = new HashSet();
        InternalUserPrincipal internalUser = commonQueries.getInternalUserPrincipal(username);
        if (null != internalUser)
        {
            Collection internalRoles = internalUser.getRolePrincipals();
            if (null != internalRoles)
            {
                Iterator internalRolesIter = internalRoles.iterator();
                while (internalRolesIter.hasNext())
                {
View Full Code Here

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

     * @see org.apache.jetspeed.security.spi.SecurityMappingHandler#setUserPrincipalInRole(java.lang.String,
     *      java.lang.String)
     */
    public void setUserPrincipalInRole(String username, String roleFullPathName) throws SecurityException
    {
        InternalUserPrincipal internalUser = commonQueries.getInternalUserPrincipal(username);
        boolean isMappingOnly = false;
        if (null == internalUser)
        {
            // This is a record for mapping only.
            isMappingOnly = true;
            internalUser = new InternalUserPrincipalImpl(UserPrincipalImpl.getFullPathFromPrincipalName(username));
        }
        Collection internalRoles = internalUser.getRolePrincipals();
        // This should not be null. Check for null should be made by the caller.
        InternalRolePrincipal internalRole = commonQueries.getInternalRolePrincipal(RolePrincipalImpl
                .getFullPathFromPrincipalName(roleFullPathName));
        // Check anyway.
        if (null == internalRole)
        {
            throw new SecurityException(SecurityException.ROLE_DOES_NOT_EXIST.create(roleFullPathName));
        }
        internalRoles.add(internalRole);
        internalUser.setRolePrincipals(internalRoles);
        commonQueries.setInternalUserPrincipal(internalUser, isMappingOnly);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.