directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r280473 - in /directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl: ./ userclass/
Date Tue, 13 Sep 2005 02:57:10 GMT
Author: trustin
Date: Mon Sep 12 19:57:02 2005
New Revision: 280473

URL: http://svn.apache.org/viewcvs?rev=280473&view=rev
Log:
Implemented all X.500 ACI data model.

Added:
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ACIItem.java  
(with props)
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/GrantAndDenial.java
  (with props)
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ItemFirstACIItem.java
  (with props)
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ItemPermission.java
  (with props)
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/Permission.java
  (with props)
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ProtectedItem.java
  (with props)
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserClass.java
  (with props)
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserFirstACIItem.java
  (with props)
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserPermission.java
  (with props)
Removed:
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/userclass/

Added: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ACIItem.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ACIItem.java?rev=280473&view=auto
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ACIItem.java (added)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ACIItem.java Mon
Sep 12 19:57:02 2005
@@ -0,0 +1,67 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.common.acl;
+
+import java.io.Serializable;
+
+public abstract class ACIItem implements Serializable
+{
+    private String identificationTag;
+    /* 0 ~ 255 */
+    private int precedence = 0;
+    private AuthenticationLevel authenticationLevel;
+    
+    protected ACIItem(
+            String identificationTag,
+            int precedence,
+            AuthenticationLevel authenticationLevel )
+    {
+        if( identificationTag == null )
+        {
+            throw new NullPointerException( "identificationTag" );
+        }
+        if( precedence < 0 || precedence > 255 )
+        {
+            throw new IllegalArgumentException( "precedence: " + precedence );
+        }
+        if( authenticationLevel == null )
+        {
+            throw new NullPointerException( "authenticationLevel" );
+        }
+        
+        this.identificationTag = identificationTag;
+        this.precedence = precedence;
+        this.authenticationLevel = authenticationLevel;
+    }
+    
+    public String getIdentificationTag()
+    {
+        return identificationTag;
+    }
+    
+    public int getPrecedence()
+    {
+        return precedence;
+    }
+    
+    public AuthenticationLevel getAuthenticationLevel()
+    {
+        return authenticationLevel;
+    }
+}

Propchange: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ACIItem.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/GrantAndDenial.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/GrantAndDenial.java?rev=280473&view=auto
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/GrantAndDenial.java
(added)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/GrantAndDenial.java
Mon Sep 12 19:57:02 2005
@@ -0,0 +1,87 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.common.acl;
+
+public class GrantAndDenial
+{
+    // Permissions that may be used in conjunction with any component of
+    // <tt>ProtectedItem</tt>s.
+    public static final GrantAndDenial GRANT_ADD = new GrantAndDenial( 0, "grantAdd", true
);
+    public static final GrantAndDenial DENY_ADD = new GrantAndDenial( 1, "denyAdd", false
);
+    public static final GrantAndDenial GRANT_DISCLOSE_ON_ERROR = new GrantAndDenial( 2, "grantDiscloseOnError",
true );
+    public static final GrantAndDenial DENY_DISCLOSE_ON_ERROR = new GrantAndDenial( 3, "denyDiscloseOnError",
false );
+    public static final GrantAndDenial GRANT_READ = new GrantAndDenial( 4, "grantRead", true
);
+    public static final GrantAndDenial DENY_READ = new GrantAndDenial( 5, "denyRead", false
);
+    public static final GrantAndDenial GRANT_REMOVE = new GrantAndDenial( 6, "grantRemove",
true );
+    public static final GrantAndDenial DENY_REMOVE = new GrantAndDenial( 7, "denyRemove",
false );
+    
+    // Permissions that may be used only in conjunction with the entry componentル
+    public static final GrantAndDenial GRANT_BROWSE = new GrantAndDenial( 8, "grantBrowse",
true );
+    public static final GrantAndDenial DENY_BROWSE = new GrantAndDenial( 9, "denyBrowse",
false );
+    public static final GrantAndDenial GRANT_EXPORT = new GrantAndDenial( 10, "grantExport",
true );
+    public static final GrantAndDenial DENY_EXPORT = new GrantAndDenial( 11, "denyExport",
false );
+    public static final GrantAndDenial GRANT_IMPORT = new GrantAndDenial( 12, "grantImport",
true );
+    public static final GrantAndDenial DENY_IMPORT = new GrantAndDenial( 13, "denyImport",
false );
+    public static final GrantAndDenial GRANT_MODIFY = new GrantAndDenial( 14, "grantModify",
true );
+    public static final GrantAndDenial DENY_MODIFY = new GrantAndDenial( 15, "denyModify",
false );
+    public static final GrantAndDenial GRANT_RENAME = new GrantAndDenial( 16, "grantRename",
true );
+    public static final GrantAndDenial DENY_RENAME = new GrantAndDenial( 17, "denyRename",
false );
+    public static final GrantAndDenial GRANT_RETURN_DN = new GrantAndDenial( 18, "grantReturnDN",
true );
+    public static final GrantAndDenial DENY_RETURN_DN = new GrantAndDenial( 19, "denyReturnDN",
false );
+
+    // Permissions that may be used in conjunction with any component,
+    // except entry, of <tt>ProtectedItem</tt>sル
+    public static final GrantAndDenial GRANT_COMPARE = new GrantAndDenial( 20, "grantCompare",
true );
+    public static final GrantAndDenial DENY_COMPARE = new GrantAndDenial( 21, "denyCompare",
false );
+    public static final GrantAndDenial GRANT_FILTER_MATCH = new GrantAndDenial( 22, "grantFilterMatch",
true );
+    public static final GrantAndDenial DENY_FILTER_MATCH = new GrantAndDenial( 23, "denyFilterMatch",
false );
+    public static final GrantAndDenial GRANT_INVOKE = new GrantAndDenial( 24, "grantInvoke",
true );
+    public static final GrantAndDenial DENY_INVOKE = new GrantAndDenial( 25, "denyInvoke",
false );
+
+    private final int code;
+    private final String description;
+    private final boolean grant;
+
+    private GrantAndDenial( int code, String description, boolean grant )
+    {
+        this.code = code;
+        this.description = description;
+        this.grant = grant;
+    }
+    
+    public int getCode()
+    {
+        return code;
+    }
+    
+    public String getDescription()
+    {
+        return description;
+    }
+    
+    public boolean isGrant()
+    {
+        return grant;
+    }
+    
+    public String toString()
+    {
+        return description + '[' + code + ']';
+    }
+}

Propchange: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/GrantAndDenial.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ItemFirstACIItem.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ItemFirstACIItem.java?rev=280473&view=auto
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ItemFirstACIItem.java
(added)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ItemFirstACIItem.java
Mon Sep 12 19:57:02 2005
@@ -0,0 +1,78 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.common.acl;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class ItemFirstACIItem extends ACIItem
+{
+    private static final long serialVersionUID = -8199453391060356463L;
+
+    private final Set protectedItems = new HashSet();
+    private final Set itemPermissions = new HashSet();
+
+    public ItemFirstACIItem(
+            String identificationTag,
+            int precedence,
+            AuthenticationLevel authenticationLevel )
+    {
+        super( identificationTag, precedence, authenticationLevel );
+    }
+
+    public boolean add( ProtectedItem protectedItem )
+    {
+        return protectedItems.add( protectedItem );
+    }
+    
+    public boolean remove( ProtectedItem protectedItem )
+    {
+        return protectedItems.remove( protectedItem );
+    }
+    
+    public Set getProtectedItems()
+    {
+        return new HashSet( protectedItems );
+    }
+    
+    public boolean add( ItemPermission itemPermission )
+    {
+        return itemPermissions.add( itemPermission );
+    }
+    
+    public boolean remove( ItemPermission itemPermission )
+    {
+        return itemPermissions.remove( itemPermission );
+    }
+    
+    public Set getItemPermissions()
+    {
+        return new HashSet( itemPermissions );
+    }
+    
+    public String toString()
+    {
+        return "itemFirstACIItem: " +
+               "identificationTag=" + getIdentificationTag() + ", " +
+               "precedence=" + getPrecedence() + ", " +
+               "authenticationLevel=" + getAuthenticationLevel() + ", " +
+               "protectedItems=" + protectedItems + ", " +
+               "itemPermissions=" + itemPermissions;
+    }
+}

Propchange: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ItemFirstACIItem.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ItemPermission.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ItemPermission.java?rev=280473&view=auto
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ItemPermission.java
(added)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ItemPermission.java
Mon Sep 12 19:57:02 2005
@@ -0,0 +1,55 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.common.acl;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class ItemPermission extends Permission
+{
+    private static final long serialVersionUID = 3940100745409337694L;
+
+    private final Set userClasses = new HashSet();
+    
+    public ItemPermission()
+    {
+    }
+
+    public boolean add( UserClass userClass )
+    {
+        return userClasses.add( userClass );
+    }
+    
+    public boolean remove( UserClass userClass )
+    {
+        return userClasses.remove( userClass );
+    }
+    
+    public Set getUserClasses()
+    {
+        return new HashSet( userClasses );
+    }
+    
+    public String toString()
+    {
+        return "itemPermission: precedence=" + getPrecedence() + ", " +
+               "userClasses=" + userClasses + ", " +
+               "grantsAndDenials=" + getGrantsAndDenials();
+    }
+}

Propchange: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ItemPermission.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/Permission.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/Permission.java?rev=280473&view=auto
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/Permission.java
(added)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/Permission.java
Mon Sep 12 19:57:02 2005
@@ -0,0 +1,62 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.common.acl;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+
+public abstract class Permission implements Serializable
+{
+    private int precedence = -1;
+    private Set grantsAndDenials = new HashSet();
+
+    protected Permission()
+    {
+    }
+    
+    public int getPrecedence()
+    {
+        return precedence;
+    }
+    
+    public void setPrecedence( int precedence )
+    {
+        if( precedence < -1 || precedence > 255 )
+        {
+            throw new IllegalArgumentException( "precedence: " + precedence );
+        }
+        this.precedence = precedence;
+    }
+    
+    public boolean add( GrantAndDenial gad )
+    {
+        return grantsAndDenials.add( gad );
+    }
+    
+    public boolean remove( GrantAndDenial gad )
+    {
+        return grantsAndDenials.remove( gad );
+    }
+    
+    public Set getGrantsAndDenials()
+    {
+        return new HashSet( grantsAndDenials );
+    }
+}

Propchange: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/Permission.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ProtectedItem.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ProtectedItem.java?rev=280473&view=auto
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ProtectedItem.java
(added)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ProtectedItem.java
Mon Sep 12 19:57:02 2005
@@ -0,0 +1,375 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.common.acl;
+
+import java.io.Serializable;
+
+import org.apache.ldap.common.filter.ExprNode;
+
+public abstract class ProtectedItem implements Serializable
+{
+    public static final Entry ENTRY = new Entry();
+    public static final AllUserAttributeTypes ALL_USER_ATTRIBUTE_TYPES = new AllUserAttributeTypes();
+    public static final AllUserAttributeTypesAndValues ALL_USER_ATTRIBUTE_TYPES_AND_VALUES
= new AllUserAttributeTypesAndValues();
+    
+
+    protected ProtectedItem()
+    {
+    }
+
+    public static class Entry extends ProtectedItem
+    {
+        private static final long serialVersionUID = -6971482229815999874L;
+
+        private Entry()
+        {
+        }
+        
+        public String toString()
+        {
+            return "entry";
+        }
+    }
+    
+    public static class AllUserAttributeTypes extends ProtectedItem
+    {
+        private static final long serialVersionUID = 3728652941148931359L;
+
+        private AllUserAttributeTypes()
+        {
+        }
+        
+        public String toString()
+        {
+            return "allUserAttributeTypes";
+        }
+    }
+    
+    public static class AllUserAttributeTypesAndValues extends ProtectedItem
+    {
+        private static final long serialVersionUID = 7250988885983604442L;
+
+        private AllUserAttributeTypesAndValues()
+        {
+        }
+        
+        public String toString()
+        {
+            return "allUserAttributeTypesAndValues";
+        }
+    }
+    
+    private abstract static class AttributeTypeProtectedItem extends ProtectedItem
+    {
+        private final String type;
+        
+        protected AttributeTypeProtectedItem( String type )
+        {
+            if( type == null )
+            {
+                throw new NullPointerException( "type" );
+            }
+            
+            this.type = type;
+        }
+        
+        public String getType()
+        {
+            return type;
+        }
+        
+        public boolean equals( Object o )
+        {
+            if( this == o )
+            {
+                return true;
+            }
+            
+            if( o == null )
+            {
+                return false;
+            }
+            
+            if( getClass().isAssignableFrom( o.getClass() ) )
+            {
+                AttributeTypeProtectedItem that = ( AttributeTypeProtectedItem ) o;
+                return this.type.equalsIgnoreCase( that.type );
+            }
+            
+            return false;
+        }
+    }
+    
+    public static class AttributeType extends AttributeTypeProtectedItem
+    {
+        private static final long serialVersionUID = -9039274739078220203L;
+
+        public AttributeType( String type )
+        {
+            super( type );
+        }
+        
+        public String toString()
+        {
+            return "attributType: " + getType();
+        }
+    }
+    
+    public static class AllAttributeValues extends AttributeTypeProtectedItem
+    {
+        private static final long serialVersionUID = -9039274739078220203L;
+
+        public AllAttributeValues( String type )
+        {
+            super( type );
+        }
+        
+        public String toString()
+        {
+            return "allAttributeValues: " + getType();
+        }
+    }
+    
+    public static class SelfValue extends AttributeTypeProtectedItem
+    {
+        private static final long serialVersionUID = -7788463918070206609L;
+
+        public SelfValue( String type )
+        {
+            super( type );
+        }
+
+        public String toString()
+        {
+            return "selfValue: " + getType();
+        }
+    }
+    
+    public static class AttributeValue extends AttributeTypeProtectedItem
+    {
+        private static final long serialVersionUID = -258318397837951363L;
+
+        private final Object value;
+        
+        public AttributeValue( String type, Object value )
+        {
+            super( type );
+            if( value == null )
+            {
+                throw new NullPointerException( "value" );
+            }
+            
+            this.value = value;
+        }
+        
+        public Object getValue()
+        {
+            return value;
+        }
+        
+        public boolean equals( Object o )
+        {
+            if( !super.equals( o ) )
+            {
+                return false;
+            }
+            
+            if( o instanceof AttributeValue )
+            {
+                AttributeValue that = ( AttributeValue ) o;
+                return this.value.equals( that.value );
+            }
+            
+            return false;
+        }
+        
+        public String toString()
+        {
+            return "attributeValue: " + getType() + "=" + value.toString();
+        }
+    }
+    
+    public static class MaxValueCount extends AttributeTypeProtectedItem
+    {
+        private static final long serialVersionUID = 5261651541488944572L;
+
+        private final int maxCount;
+        
+        public MaxValueCount( String type, int maxCount )
+        {
+            super( type );
+            this.maxCount = maxCount;
+        }
+        
+        public int getMaxCount()
+        {
+            return maxCount;
+        }
+        
+        public boolean equals( Object o )
+        {
+            if( !super.equals( o ) )
+            {
+                return false;
+            }
+            
+            if( o instanceof MaxValueCount )
+            {
+                MaxValueCount that = ( MaxValueCount ) o;
+                return this.maxCount == that.maxCount;
+            }
+            
+            return false;
+        }
+
+        public String toString()
+        {
+            return "maxValueCount: " + getType() + ", " + maxCount;
+        }
+    }
+
+    public static class RangeOfValues extends ProtectedItem
+    {
+        private static final long serialVersionUID = -8553151906617285325L;
+
+        private final ExprNode filter;
+        
+        public RangeOfValues( ExprNode filter )
+        {
+            if( filter == null )
+            {
+                throw new NullPointerException( "filter" );
+            }
+            
+            this.filter = filter;
+        }
+        
+        public ExprNode getFilter()
+        {
+            return filter;
+        }
+        
+        public boolean equals( Object o )
+        {
+            if( this == o )
+            {
+                return true;
+            }
+            
+            if( o instanceof RangeOfValues )
+            {
+                RangeOfValues that = ( RangeOfValues ) o;
+                return this.filter.equals( that.filter );
+            }
+            
+            return false;
+        }
+
+        public String toString()
+        {
+            StringBuffer buf = new StringBuffer();
+            buf.append( "rangeOfValues: " );
+            filter.printToBuffer( buf );
+            return buf.toString();
+        }
+    }
+
+    public static class MaxImmSub extends ProtectedItem
+    {
+        private static final long serialVersionUID = -8553151906617285325L;
+
+        private final int value;
+        
+        public MaxImmSub( int value )
+        {
+            this.value = value;
+        }
+        
+        public int getValue()
+        {
+            return value;
+        }
+        
+        public boolean equals( Object o )
+        {
+            if( this == o )
+            {
+                return true;
+            }
+            
+            if( o instanceof MaxImmSub )
+            {
+                MaxImmSub that = ( MaxImmSub ) o;
+                return this.value == that.value;
+            }
+            
+            return false;
+        }
+
+        public String toString()
+        {
+            return "maxImmSub: " + value;
+        }
+    }
+    
+    public static class RestrictedBy extends AttributeTypeProtectedItem
+    {
+        private static final long serialVersionUID = -8157637446588058799L;
+
+        private final String valuesIn;
+        
+        public RestrictedBy( String type, String valuesIn )
+        {
+            super( type );
+            if( valuesIn == null )
+            {
+                throw new NullPointerException( "valuesIn" );
+            }
+            this.valuesIn = valuesIn;
+        }
+        
+        public String getValuesIn()
+        {
+            return valuesIn;
+        }
+        
+        public boolean equals( Object o )
+        {
+            if( !super.equals( o ) )
+            {
+                return false;
+            }
+            
+            if( o instanceof RestrictedBy )
+            {
+                RestrictedBy that = ( RestrictedBy ) o;
+                return this.valuesIn.equalsIgnoreCase( that.valuesIn );
+            }
+            
+            return false;
+        }
+        
+        public String toString()
+        {
+            return "restrictedBy: " + getType() + ", " + valuesIn;
+        }
+    }
+
+    // TODO: Contexts and Classes
+}

Propchange: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/ProtectedItem.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserClass.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserClass.java?rev=280473&view=auto
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserClass.java
(added)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserClass.java
Mon Sep 12 19:57:02 2005
@@ -0,0 +1,175 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.common.acl;
+
+import java.io.Serializable;
+
+import org.apache.ldap.common.name.LdapName;
+import org.apache.ldap.common.subtree.SubtreeSpecification;
+
+public abstract class UserClass implements Serializable
+{
+    public static final AllUsers ALL_USERS = new AllUsers();
+    public static final ThisEntry THIS_ENTRY = new ThisEntry();
+    
+    protected UserClass()
+    {
+    }
+    
+    public static class AllUsers extends UserClass
+    {
+        private static final long serialVersionUID = 8967984720792510292L;
+        
+        private AllUsers()
+        {
+        }
+        
+        public String toString()
+        {
+            return "allUsers";
+        }
+    }
+    
+    public static class ThisEntry extends UserClass
+    {
+        private static final long serialVersionUID = -8189325270233754470L;
+
+        private ThisEntry()
+        {
+        }
+
+        public String toString()
+        {
+            return "thisEntry";
+        }
+    }
+    
+    private static abstract class NamedUserClass extends UserClass
+    {
+        protected final LdapName name;
+        
+        protected NamedUserClass( LdapName name )
+        {
+            this.name = ( LdapName ) name.clone();
+        }
+        
+        public LdapName getName()
+        {
+            return ( LdapName ) name.clone();
+        }
+
+        public boolean equals( Object o )
+        {
+            if( this == o )
+            {
+                return true;
+            }
+            
+            if( o == null )
+            {
+                return false;
+            }
+            
+            if( getClass().isAssignableFrom( o.getClass() ) )
+            {
+                Name that = ( Name ) o;
+                return this.name.equals( that.name );
+            }
+            
+            return false;
+        }
+        
+        public String toString()
+        {
+            return name.toString();
+        }
+    }
+
+    public static class Name extends NamedUserClass
+    {
+        private static final long serialVersionUID = -4168412030168359882L;
+
+        public Name( LdapName username )
+        {
+            super( username );
+        }
+        
+        public String toString()
+        {
+            return "name: " + super.toString();
+        }
+    }
+    
+    public static class UserGroup extends NamedUserClass
+    {
+        private static final long serialVersionUID = 8887107815072965807L;
+
+        public UserGroup( LdapName groupName )
+        {
+            super( groupName );
+        }
+        
+        public String toString()
+        {
+            return "userGroup: " + super.toString();
+        }
+    }
+
+    public static class Subtree extends UserClass
+    {
+        private static final long serialVersionUID = 3949337699049701332L;
+
+        protected final SubtreeSpecification subtreeSpecification;
+        
+        protected Subtree( SubtreeSpecification subtreeSpec )
+        {
+            if( subtreeSpec == null )
+            {
+                throw new NullPointerException( "subtreeSpec" );
+            }
+            this.subtreeSpecification = subtreeSpec;
+        }
+        
+        public SubtreeSpecification getSubtreeSpecification()
+        {
+            return subtreeSpecification;
+        }
+
+        public boolean equals( Object o )
+        {
+            if( this == o )
+            {
+                return true;
+            }
+            
+            if( o instanceof Subtree )
+            {
+                Subtree that = ( Subtree ) o;
+                return this.subtreeSpecification.equals( that.subtreeSpecification );
+            }
+            
+            return false;
+        }
+        
+        public String toString()
+        {
+            return "subtree: " + subtreeSpecification;
+        }
+    }
+}

Propchange: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserClass.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserFirstACIItem.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserFirstACIItem.java?rev=280473&view=auto
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserFirstACIItem.java
(added)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserFirstACIItem.java
Mon Sep 12 19:57:02 2005
@@ -0,0 +1,78 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.common.acl;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class UserFirstACIItem extends ACIItem
+{
+    private static final long serialVersionUID = 5587483838404246148L;
+
+    private final Set userClasses = new HashSet();
+    private final Set userPermissions = new HashSet();
+
+    public UserFirstACIItem(
+            String identificationTag,
+            int precedence,
+            AuthenticationLevel authenticationLevel )
+    {
+        super( identificationTag, precedence, authenticationLevel );
+    }
+
+    public boolean add( UserClass userClass )
+    {
+        return userClasses.add( userClass );
+    }
+    
+    public boolean remove( UserClass userClass )
+    {
+        return userClasses.remove( userClass );
+    }
+    
+    public Set getUserClass()
+    {
+        return new HashSet( userClasses );
+    }
+    
+    public boolean add( UserPermission userPermission )
+    {
+        return userPermissions.add( userPermission );
+    }
+    
+    public boolean remove( UserPermission userPermission )
+    {
+        return userPermissions.remove( userPermission );
+    }
+    
+    public Set getUserPermission()
+    {
+        return new HashSet( userPermissions );
+    }
+    
+    public String toString()
+    {
+        return "userFirstACIItem: " +
+               "identificationTag=" + getIdentificationTag() + ", " +
+               "precedence=" + getPrecedence() + ", " +
+               "authenticationLevel=" + getAuthenticationLevel() + ", " +
+               "userClasses=" + userClasses + ", " +
+               "userPermissions=" + userPermissions;
+    }
+}

Propchange: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserFirstACIItem.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserPermission.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserPermission.java?rev=280473&view=auto
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserPermission.java
(added)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserPermission.java
Mon Sep 12 19:57:02 2005
@@ -0,0 +1,55 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.common.acl;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class UserPermission extends Permission
+{
+    private static final long serialVersionUID = 3940100745409337694L;
+
+    private final Set protectedItems = new HashSet();
+    
+    public UserPermission()
+    {
+    }
+
+    public boolean add( ProtectedItem protectedItem )
+    {
+        return protectedItems.add( protectedItem );
+    }
+    
+    public boolean remove( ProtectedItem protectedItem )
+    {
+        return protectedItems.remove( protectedItem );
+    }
+    
+    public Set getProtectedItems()
+    {
+        return new HashSet( protectedItems );
+    }
+    
+    public String toString()
+    {
+        return "itemPermission: precedence=" + getPrecedence() + ", " +
+               "protectedItems=" + protectedItems + ", " +
+               "grantsAndDenials=" + getGrantsAndDenials();
+    }
+}

Propchange: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/acl/UserPermission.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision



Mime
View raw message