You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2007/02/02 06:35:17 UTC
svn commit: r502507 - in /directory/apacheds/trunk:
core-unit/src/test/java/org/apache/directory/server/core/schema/
core/src/main/java/org/apache/directory/server/core/authz/
core/src/main/java/org/apache/directory/server/core/exception/
core/src/main...
Author: akarasulu
Date: Thu Feb 1 21:35:12 2007
New Revision: 502507
URL: http://svn.apache.org/viewvc?view=rev&rev=502507
Log:
adding extra test case for delete of SSSE and just fixing various generics complaints in eclipse
Modified:
directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryITest.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
Modified: directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryITest.java?view=diff&rev=502507&r1=502506&r2=502507
==============================================================================
--- directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryITest.java (original)
+++ directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryITest.java Thu Feb 1 21:35:12 2007
@@ -28,6 +28,8 @@
import javax.naming.directory.SearchResult;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
/**
@@ -91,5 +93,22 @@
assertEquals( GLOBAL_SUBSCHEMA_DN, getSubschemaSubentryDN() );
Attributes subschemaSubentryAttrs = getSubschemaSubentryAttributes();
assertNotNull( subschemaSubentryAttrs );
+ }
+
+
+ /**
+ * Tests the rejection of a delete operation on the SubschemaSubentry (SSSE).
+ */
+ public void testSSSEDeleteRejection() throws NamingException
+ {
+ try
+ {
+ rootDSE.destroySubcontext( getSubschemaSubentryDN() );
+ fail( "You are not allowed to delete the global schema subentry" );
+ }
+ catch( LdapOperationNotSupportedException e )
+ {
+ assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, e.getResultCode() );
+ }
}
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java?view=diff&rev=502507&r1=502506&r2=502507
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java Thu Feb 1 21:35:12 2007
@@ -41,6 +41,7 @@
import org.apache.directory.server.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.aci.ACIItem;
import org.apache.directory.shared.ldap.aci.ACIItemParser;
+import org.apache.directory.shared.ldap.aci.ACITuple;
import org.apache.directory.shared.ldap.aci.MicroOperation;
import org.apache.directory.shared.ldap.exception.LdapNamingException;
import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -221,7 +222,7 @@
* @param entry the target entry that access to is being controled
* @throws NamingException if there are problems accessing attribute values
*/
- private void addPerscriptiveAciTuples( PartitionNexusProxy proxy, Collection tuples, LdapDN dn,
+ private void addPerscriptiveAciTuples( PartitionNexusProxy proxy, Collection<ACITuple> tuples, LdapDN dn,
Attributes entry ) throws NamingException
{
Attribute oc = ServerUtils.getAttribute( objectClassType, entry );
@@ -263,7 +264,7 @@
* @param entry the target entry that access to is being regulated
* @throws NamingException if there are problems accessing attribute values
*/
- private void addEntryAciTuples( Collection tuples, Attributes entry ) throws NamingException
+ private void addEntryAciTuples( Collection<ACITuple> tuples, Attributes entry ) throws NamingException
{
Attribute entryAci = entry.get( ENTRYACI_ATTR );
if ( entryAci == null )
@@ -301,7 +302,7 @@
* @param entry the target entry that access to is being regulated
* @throws NamingException if there are problems accessing attribute values
*/
- private void addSubentryAciTuples( PartitionNexusProxy proxy, Collection tuples, LdapDN dn, Attributes entry )
+ private void addSubentryAciTuples( PartitionNexusProxy proxy, Collection<ACITuple> tuples, LdapDN dn, Attributes entry )
throws NamingException
{
// only perform this for subentries
@@ -399,7 +400,7 @@
// Assemble all the information required to make an access control decision
Set userGroups = groupCache.getGroups( principalDn.toNormName() );
- Collection tuples = new HashSet();
+ Collection<ACITuple> tuples = new HashSet<ACITuple>();
// Build the total collection of tuples to be considered for add rights
// NOTE: entryACI are NOT considered in adds (it would be a security breech)
@@ -459,7 +460,7 @@
}
Set userGroups = groupCache.getGroups( principalDn.toString() );
- Collection tuples = new HashSet();
+ Collection<ACITuple> tuples = new HashSet<ACITuple>();
addPerscriptiveAciTuples( proxy, tuples, name, entry );
addEntryAciTuples( tuples, entry );
addSubentryAciTuples( proxy, tuples, name, entry );
@@ -499,7 +500,7 @@
}
Set userGroups = groupCache.getGroups( principalDn.toString() );
- Collection tuples = new HashSet();
+ Collection<ACITuple> tuples = new HashSet<ACITuple>();
addPerscriptiveAciTuples( proxy, tuples, name, entry );
addEntryAciTuples( tuples, entry );
addSubentryAciTuples( proxy, tuples, name, entry );
@@ -564,7 +565,7 @@
}
Set userGroups = groupCache.getGroups( principalDn.toString() );
- Collection tuples = new HashSet();
+ Collection<ACITuple> tuples = new HashSet<ACITuple>();
addPerscriptiveAciTuples( proxy, tuples, name, entry );
addEntryAciTuples( tuples, entry );
addSubentryAciTuples( proxy, tuples, name, entry );
@@ -616,7 +617,7 @@
}
Set userGroups = groupCache.getGroups( principalDn.toNormName() );
- Collection tuples = new HashSet();
+ Collection<ACITuple> tuples = new HashSet<ACITuple>();
addPerscriptiveAciTuples( proxy, tuples, name, entry );
addEntryAciTuples( tuples, entry );
addSubentryAciTuples( proxy, tuples, name, entry );
@@ -655,7 +656,7 @@
PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
LdapDN userName = principal.getJndiName();
Set userGroups = groupCache.getGroups( userName.toNormName() );
- Collection tuples = new HashSet();
+ Collection<ACITuple> tuples = new HashSet<ACITuple>();
addPerscriptiveAciTuples( proxy, tuples, dn, entry );
addEntryAciTuples( tuples, entry );
addSubentryAciTuples( proxy, tuples, dn, entry );
@@ -747,7 +748,7 @@
}
Set userGroups = groupCache.getGroups( principalDn.toString() );
- Collection tuples = new HashSet();
+ Collection<ACITuple> tuples = new HashSet<ACITuple>();
addPerscriptiveAciTuples( proxy, tuples, name, entry );
addEntryAciTuples( tuples, entry );
addSubentryAciTuples( proxy, tuples, name, entry );
@@ -817,7 +818,7 @@
}
Set userGroups = groupCache.getGroups( principalDn.toString() );
- Collection tuples = new HashSet();
+ Collection<ACITuple> tuples = new HashSet<ACITuple>();
addPerscriptiveAciTuples( proxy, tuples, oriChildName, entry );
addEntryAciTuples( tuples, entry );
addSubentryAciTuples( proxy, tuples, oriChildName, entry );
@@ -844,7 +845,7 @@
subentryAttrs.put( ( Attribute ) attrList.next() );
}
- Collection destTuples = new HashSet();
+ Collection<ACITuple> destTuples = new HashSet<ACITuple>();
// Import permission is only valid for prescriptive ACIs
addPerscriptiveAciTuples( proxy, destTuples, newName, subentryAttrs );
// Evaluate the target context to see whether it
@@ -913,7 +914,7 @@
}
Set userGroups = groupCache.getGroups( principalDn.toString() );
- Collection tuples = new HashSet();
+ Collection<ACITuple> tuples = new HashSet<ACITuple>();
addPerscriptiveAciTuples( proxy, tuples, oriChildName, entry );
addEntryAciTuples( tuples, entry );
addSubentryAciTuples( proxy, tuples, oriChildName, entry );
@@ -940,7 +941,7 @@
subentryAttrs.put( ( Attribute ) attrList.next() );
}
- Collection destTuples = new HashSet();
+ Collection<ACITuple> destTuples = new HashSet<ACITuple>();
// Import permission is only valid for prescriptive ACIs
addPerscriptiveAciTuples( proxy, destTuples, newName, subentryAttrs );
// Evaluate the target context to see whether it
@@ -1012,7 +1013,7 @@
}
Set userGroups = groupCache.getGroups( principalDn.toNormName() );
- Collection tuples = new HashSet();
+ Collection<ACITuple> tuples = new HashSet<ACITuple>();
addPerscriptiveAciTuples( proxy, tuples, name, entry );
addEntryAciTuples( tuples, entry );
addSubentryAciTuples( proxy, tuples, name, entry );
@@ -1050,7 +1051,7 @@
{
entry = proxy.lookup( matched, PartitionNexusProxy.GETMATCHEDDN_BYPASS );
Set userGroups = groupCache.getGroups( principalDn.toString() );
- Collection tuples = new HashSet();
+ Collection<ACITuple> tuples = new HashSet<ACITuple>();
addPerscriptiveAciTuples( proxy, tuples, matched, entry );
addEntryAciTuples( tuples, entry );
addSubentryAciTuples( proxy, tuples, matched, entry );
@@ -1085,7 +1086,7 @@
ServerLdapContext ctx = ( ServerLdapContext ) invocation.getCaller();
LdapDN userDn = ctx.getPrincipal().getJndiName();
Set userGroups = groupCache.getGroups( userDn.toNormName() );
- Collection tuples = new HashSet();
+ Collection<ACITuple> tuples = new HashSet<ACITuple>();
addPerscriptiveAciTuples( invocation.getProxy(), tuples, normName, entry );
addEntryAciTuples( tuples, entry );
addSubentryAciTuples( invocation.getProxy(), tuples, normName, entry );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java?view=diff&rev=502507&r1=502506&r2=502507
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java Thu Feb 1 21:35:12 2007
@@ -44,6 +44,7 @@
import org.apache.directory.server.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.aci.ACIItem;
import org.apache.directory.shared.ldap.aci.ACIItemParser;
+import org.apache.directory.shared.ldap.aci.ACITuple;
import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
import org.apache.directory.shared.ldap.filter.AssertionEnum;
import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -52,6 +53,7 @@
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
+import org.apache.directory.shared.ldap.schema.OidNormalizer;
import org.apache.directory.shared.ldap.util.AttributeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -80,7 +82,7 @@
/** cloned startup environment properties we use for subentry searching */
private final Hashtable env;
/** a map of strings to ACITuple collections */
- private final Map tuples = new HashMap();
+ private final Map<String,List> tuples = new HashMap<String,List>();
/** a handle on the partition nexus */
private final PartitionNexus nexus;
/** a normalizing ACIItem parser */
@@ -89,7 +91,7 @@
/**
* The OIDs normalizer map
*/
- private Map normalizerMap;
+ private Map<String, OidNormalizer> normalizerMap;
/**
* Creates a ACITuple cache.
@@ -183,7 +185,7 @@
return;
}
- List entryTuples = new ArrayList();
+ List<ACITuple> entryTuples = new ArrayList<ACITuple>();
for ( int ii = 0; ii < aci.size(); ii++ )
{
@@ -252,7 +254,8 @@
}
- public List getACITuples( String subentryDn )
+ @SuppressWarnings("unchecked")
+ public List<ACITuple> getACITuples( String subentryDn )
{
List aciTuples = ( List ) tuples.get( subentryDn );
if ( aciTuples == null )
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java?view=diff&rev=502507&r1=502506&r2=502507
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java Thu Feb 1 21:35:12 2007
@@ -43,6 +43,7 @@
import org.apache.directory.shared.ldap.exception.LdapNameAlreadyBoundException;
import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
import org.apache.directory.shared.ldap.exception.LdapNamingException;
+import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
@@ -145,6 +146,14 @@
*/
public void delete( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
{
+ if ( name.getNormName().equalsIgnoreCase( subschemSubentryDn.getNormName() ) )
+ {
+ throw new LdapOperationNotSupportedException(
+ "Can not allow the deletion of the subschemaSubentry (" +
+ subschemSubentryDn + ") for the global schema.",
+ ResultCodeEnum.UNWILLING_TO_PERFORM );
+ }
+
// check if entry to delete exists
String msg = "Attempt to delete non-existant entry: ";
assertHasEntry( nextInterceptor, msg, name );
@@ -187,6 +196,11 @@
*/
public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
{
+ if ( name.getNormName().equals( subschemSubentryDn.getNormName() ) )
+ {
+ return nexus.getRootDSE();
+ }
+
String msg = "Attempt to lookup non-existant entry: ";
assertHasEntry( nextInterceptor, msg, name );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?view=diff&rev=502507&r1=502506&r2=502507
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Thu Feb 1 21:35:12 2007
@@ -1753,6 +1753,7 @@
}
}
+
public void delete( NextInterceptor next, LdapDN normName ) throws NamingException
{
Attributes entry = nexus.lookup( normName );