directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r960245 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
Date Sat, 03 Jul 2010 17:39:30 GMT
Author: elecharny
Date: Sat Jul  3 17:39:30 2010
New Revision: 960245

URL: http://svn.apache.org/viewvc?rev=960245&view=rev
Log:
Some cleanup 

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=960245&r1=960244&r2=960245&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
Sat Jul  3 17:39:30 2010
@@ -257,16 +257,18 @@ public class AciAuthorizationInterceptor
     private void addPerscriptiveAciTuples( OperationContext opContext, Collection<ACITuple>
tuples, DN dn, Entry entry )
         throws LdapException
     {
-        EntryAttribute oc = null;
-
+        Entry originalEntry = null;
+        
         if ( entry instanceof ClonedServerEntry )
         {
-            oc = ( ( ClonedServerEntry ) entry ).getOriginalEntry().get( OBJECT_CLASS_AT
);
+            originalEntry = ((ClonedServerEntry)entry).getOriginalEntry();
         }
         else
         {
-            oc = entry.get( OBJECT_CLASS_AT );
+            originalEntry = entry;
         }
+        
+        EntryAttribute oc = originalEntry.get( OBJECT_CLASS_AT );
 
         /*
          * If the protected entry is a subentry, then the entry being evaluated
@@ -281,10 +283,10 @@ public class AciAuthorizationInterceptor
         {
             DN parentDn = ( DN ) dn.clone();
             parentDn.remove( dn.size() - 1 );
-            entry = opContext.lookup( parentDn, ByPassConstants.LOOKUP_BYPASS );
+            originalEntry = opContext.lookup( parentDn, ByPassConstants.LOOKUP_BYPASS );
         }
 
-        EntryAttribute subentries = entry.get( ACCESS_CONTROL_SUBENTRY_AT );
+        EntryAttribute subentries = originalEntry.get( ACCESS_CONTROL_SUBENTRY_AT );
 
         if ( subentries == null )
         {
@@ -358,8 +360,7 @@ public class AciAuthorizationInterceptor
 
         // get the parent or administrative entry for this subentry since it
         // will contain the subentryACI attributes that effect subentries
-        DN parentDn = ( DN ) dn.clone();
-        parentDn.remove( dn.size() - 1 );
+        DN parentDn = dn.getParent();
         Entry administrativeEntry = ( ( ClonedServerEntry ) opContext.lookup( parentDn, ByPassConstants.LOOKUP_BYPASS
) )
             .getOriginalEntry();
 
@@ -524,7 +525,7 @@ public class AciAuthorizationInterceptor
 
         Set<DN> userGroups = groupCache.getGroups( principalDn.getNormName() );
         Collection<ACITuple> tuples = new HashSet<ACITuple>();
-        addPerscriptiveAciTuples( deleteContext, tuples, dn, ( ( ClonedServerEntry ) entry
).getOriginalEntry() );
+        addPerscriptiveAciTuples( deleteContext, tuples, dn, entry );
         addEntryAciTuples( tuples, entry );
         addSubentryAciTuples( deleteContext, tuples, dn, entry );
 
@@ -575,7 +576,7 @@ public class AciAuthorizationInterceptor
 
         Set<DN> userGroups = groupCache.getGroups( principalDn.getName() );
         Collection<ACITuple> tuples = new HashSet<ACITuple>();
-        addPerscriptiveAciTuples( modifyContext, tuples, dn, ( ( ClonedServerEntry ) entry
).getOriginalEntry() );
+        addPerscriptiveAciTuples( modifyContext, tuples, dn, entry );
         addEntryAciTuples( tuples, entry );
         addSubentryAciTuples( modifyContext, tuples, dn, entry );
 
@@ -689,7 +690,7 @@ public class AciAuthorizationInterceptor
         Entry entry = hasEntryContext.lookup( dn, ByPassConstants.HAS_ENTRY_BYPASS );
         Set<DN> userGroups = groupCache.getGroups( principalDn.getNormName() );
         Collection<ACITuple> tuples = new HashSet<ACITuple>();
-        addPerscriptiveAciTuples( hasEntryContext, tuples, dn, ( ( ClonedServerEntry ) entry
).getOriginalEntry() );
+        addPerscriptiveAciTuples( hasEntryContext, tuples, dn, entry );
         addEntryAciTuples( tuples, ( ( ClonedServerEntry ) entry ).getOriginalEntry() );
         addSubentryAciTuples( hasEntryContext, tuples, dn, ( ( ClonedServerEntry ) entry
).getOriginalEntry() );
 
@@ -944,7 +945,7 @@ public class AciAuthorizationInterceptor
 
         Set<DN> userGroups = groupCache.getGroups( principalDn.getNormName() );
         Collection<ACITuple> tuples = new HashSet<ACITuple>();
-        addPerscriptiveAciTuples( moveContext, tuples, oriChildName, ( ( ClonedServerEntry
) entry ).getOriginalEntry() );
+        addPerscriptiveAciTuples( moveContext, tuples, oriChildName, entry );
         addEntryAciTuples( tuples, entry );
         addSubentryAciTuples( moveContext, tuples, oriChildName, entry );
 
@@ -1087,7 +1088,7 @@ public class AciAuthorizationInterceptor
         DN userDn = principal.getDN();
         Set<DN> userGroups = groupCache.getGroups( userDn.getNormName() );
         Collection<ACITuple> tuples = new HashSet<ACITuple>();
-        addPerscriptiveAciTuples( opContext, tuples, normName, clonedEntry.getOriginalEntry()
);
+        addPerscriptiveAciTuples( opContext, tuples, normName, clonedEntry );
         addEntryAciTuples( tuples, clonedEntry.getOriginalEntry() );
         addSubentryAciTuples( opContext, tuples, normName, clonedEntry.getOriginalEntry()
);
 



Mime
View raw message