Package org.apache.ldap.common.aci

Examples of org.apache.ldap.common.aci.ProtectedItem


                continue;
            }

            for( Iterator j = tuple.getProtectedItems().iterator(); j.hasNext(); )
            {
                ProtectedItem item = ( ProtectedItem ) j.next();
                if( item instanceof ProtectedItem.MaxValueCount )
                {
                    ProtectedItem.MaxValueCount mvc = ( ProtectedItem.MaxValueCount ) item;
                    if( isRemovable( mvc, attrId, entry ) )
                    {
View Full Code Here


                continue;
            }

            for( Iterator j = tuple.getProtectedItems().iterator(); j.hasNext(); )
            {
                ProtectedItem item = ( ProtectedItem ) j.next();
                if( item instanceof ProtectedItem.MaxImmSub )
                {
                    if( immSubCount < 0 )
                    {
                        immSubCount = getImmSubCount( proxy, entryName );
View Full Code Here

        for( Iterator i = tuples.iterator(); i.hasNext(); )
        {
            ACITuple tuple = ( ACITuple ) i.next();
            for( Iterator j = tuple.getProtectedItems().iterator(); j.hasNext(); )
            {
                ProtectedItem item = ( ProtectedItem ) j.next();
                if( item instanceof ProtectedItem.AttributeType ||
                    item instanceof ProtectedItem.AllAttributeValues ||
                    item instanceof ProtectedItem.SelfValue ||
                    item instanceof ProtectedItem.AttributeValue )
                {
                    filteredTuples.add( tuple );
                    break;
                }
            }
        }

        if( filteredTuples.size() > 0 )
        {
            return filteredTuples;
        }

        // If the protected item is an attribute value, and there are tuples
        // that specify the attribute value explicitly, discard all other tuples.
        // A protected item which is a rangeOfValues is to be treated as
        // specifying an attribute value explicitly.
        for( Iterator i = tuples.iterator(); i.hasNext(); )
        {
            ACITuple tuple = ( ACITuple ) i.next();
            for( Iterator j = tuple.getProtectedItems().iterator(); j.hasNext(); )
            {
                ProtectedItem item = ( ProtectedItem ) j.next();
                if( item instanceof ProtectedItem.RangeOfValues )
                {
                    filteredTuples.add( tuple );
                }
            }
View Full Code Here

    public boolean isRemovable( ACITuple tuple, String attrId, Object attrValue, Attributes entry )
    {
        for( Iterator i = tuple.getProtectedItems().iterator(); i.hasNext(); )
        {
            ProtectedItem item = ( ProtectedItem ) i.next();
            if( item instanceof ProtectedItem.RestrictedBy )
            {
                ProtectedItem.RestrictedBy rb = ( ProtectedItem.RestrictedBy ) item;
                for( Iterator k = rb.iterator(); k.hasNext(); )
                {
View Full Code Here

    private boolean isRelated( ACITuple tuple, OperationScope scope, Name userName, Name entryName, String attrId, Object attrValue, Attributes entry ) throws NamingException, InternalError
    {
        for( Iterator i = tuple.getProtectedItems().iterator(); i.hasNext(); )
        {
            ProtectedItem item = ( ProtectedItem ) i.next();
            if( item == ProtectedItem.ENTRY )
            {
                if( scope == OperationScope.ENTRY )
                {
                    return true;
                }
            }
            else if( item == ProtectedItem.ALL_USER_ATTRIBUTE_TYPES )
            {
                if( scope != OperationScope.ATTRIBUTE_TYPE &&
                    scope != OperationScope.ATTRIBUTE_TYPE_AND_VALUE )
                {
                    continue;
                }

                if( isUserAttribute( attrId ) )
                {
                    return true;
                }
            }
            else if( item == ProtectedItem.ALL_USER_ATTRIBUTE_TYPES_AND_VALUES )
            {
                if( scope != OperationScope.ATTRIBUTE_TYPE &&
                    scope != OperationScope.ATTRIBUTE_TYPE_AND_VALUE )
                {
                    continue;
                }

                if( isUserAttribute( attrId ) )
                {
                    return true;
                }
            }
            else if( item instanceof ProtectedItem.AllAttributeValues )
            {
                if( scope != OperationScope.ATTRIBUTE_TYPE &&
                    scope != OperationScope.ATTRIBUTE_TYPE_AND_VALUE )
                {
                    continue;
                }

                ProtectedItem.AllAttributeValues aav = ( ProtectedItem.AllAttributeValues ) item;
                for( Iterator j = aav.iterator(); j.hasNext(); )
                {
                    if( attrId.equalsIgnoreCase( ( String ) j.next() ) )
                    {
                        return true;
                    }
                }
            }
            else if( item instanceof ProtectedItem.AttributeType )
            {
                if( scope != OperationScope.ATTRIBUTE_TYPE )
                {
                    continue;
                }

                ProtectedItem.AttributeType at = ( ProtectedItem.AttributeType ) item;
                for( Iterator j = at.iterator(); j.hasNext(); )
                {
                    if( attrId.equalsIgnoreCase( ( String ) j.next() ) )
                    {
                        return true;
                    }
                }
            }
            else if( item instanceof ProtectedItem.AttributeValue )
            {
                if( scope != OperationScope.ATTRIBUTE_TYPE_AND_VALUE )
                {
                    continue;
                }

                ProtectedItem.AttributeValue av = ( ProtectedItem.AttributeValue ) item;
                for( Iterator j = av.iterator(); j.hasNext(); )
                {
                    Attribute attr = ( Attribute ) j.next();
                    if( attrId.equalsIgnoreCase( attr.getID() ) &&
                            attr.contains( attrValue ) )
                    {
                        return true;
                    }
                }
            }
            else if( item instanceof ProtectedItem.Classes )
            {
                ProtectedItem.Classes c = ( ProtectedItem.Classes ) item;
                if( refinementEvaluator.evaluate(
                        c.getClasses(), entry.get( "objectClass" ) ) )
                {
                    return true;
                }
            }
            else if( item instanceof ProtectedItem.MaxImmSub )
            {
                return true;
            }
            else if( item instanceof ProtectedItem.MaxValueCount )
            {
                if( scope != OperationScope.ATTRIBUTE_TYPE_AND_VALUE )
                {
                    continue;
                }

                ProtectedItem.MaxValueCount mvc = ( ProtectedItem.MaxValueCount ) item;
                for( Iterator j = mvc.iterator(); j.hasNext(); )
                {
                    MaxValueCountItem mvcItem = ( MaxValueCountItem ) j.next();
                    if( attrId.equalsIgnoreCase( mvcItem.getAttributeType() ) )
                    {
                        return true;
                    }
                }
            }
            else if( item instanceof ProtectedItem.RangeOfValues )
            {
                ProtectedItem.RangeOfValues rov = ( ProtectedItem.RangeOfValues ) item;
                if( entryEvaluator.evaluate( rov.getFilter(), entryName.toString(), entry ) )
                {
                    return true;
                }
            }
            else if( item instanceof ProtectedItem.RestrictedBy )
            {
                if( scope != OperationScope.ATTRIBUTE_TYPE_AND_VALUE )
                {
                    continue;
                }

                ProtectedItem.RestrictedBy rb = ( ProtectedItem.RestrictedBy ) item;
                for( Iterator j = rb.iterator(); j.hasNext(); )
                {
                    RestrictedByItem rbItem = ( RestrictedByItem ) j.next();
                    if( attrId.equalsIgnoreCase( rbItem.getAttributeType() ) )
                    {
                        return true;
                    }
                }
            }
            else if( item instanceof ProtectedItem.SelfValue )
            {
                if( scope != OperationScope.ATTRIBUTE_TYPE_AND_VALUE &&
                    scope != OperationScope.ATTRIBUTE_TYPE )
                {
                    continue;
                }

                ProtectedItem.SelfValue sv = ( ProtectedItem.SelfValue ) item;
                for( Iterator j = sv.iterator(); j.hasNext(); )
                {
                    String svItem = String.valueOf( j.next() );
                    if( svItem.equalsIgnoreCase( attrId ) )
                    {
                        Attribute attr = entry.get( attrId );
                        if( attr != null && ( attr.contains( userName ) || attr.contains( userName.toString() ) ) )
                        {
                            return true;
                        }
                    }
                }
            }
            else
            {
                throw new InternalError( "Unexpected protectedItem: " + item.getClass().getName() );
            }
        }

        return false;
    }
View Full Code Here

TOP

Related Classes of org.apache.ldap.common.aci.ProtectedItem

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.