1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.ldap.server.authz.support;
20
21 import java.util.Collection;
22 import java.util.Iterator;
23
24 import javax.naming.Name;
25 import javax.naming.NamingException;
26 import javax.naming.directory.Attributes;
27
28 import org.apache.ldap.common.aci.ACITuple;
29 import org.apache.ldap.common.aci.AuthenticationLevel;
30 import org.apache.ldap.common.aci.MicroOperation;
31 import org.apache.ldap.server.partition.DirectoryPartitionNexusProxy;
32
33
34 /***
35 * An {@link ACITupleFilter} that discard tuples which doesn't contain any
36 * related {@link MicroOperation}s. (18.8.3.4, X.501)
37 *
38 * @author The Apache Directory Project
39 * @version $Rev: 326050 $, $Date: 2005-10-18 04:19:14 -0400 (Tue, 18 Oct 2005) $
40 *
41 */
42 public class MicroOperationFilter implements ACITupleFilter
43 {
44 public Collection filter( Collection tuples, OperationScope scope, DirectoryPartitionNexusProxy proxy,
45 Collection userGroupNames, Name userName, Attributes userEntry,
46 AuthenticationLevel authenticationLevel, Name entryName, String attrId,
47 Object attrValue, Attributes entry, Collection microOperations )
48 throws NamingException
49 {
50 if( tuples.size() == 0 )
51 {
52 return tuples;
53 }
54
55 for( Iterator i = tuples.iterator(); i.hasNext(); )
56 {
57 ACITuple tuple = ( ACITuple ) i.next();
58
59
60
61
62
63
64
65 boolean retain = true;
66 for( Iterator j = microOperations.iterator(); j.hasNext(); )
67 {
68 MicroOperation microOp = ( MicroOperation ) j.next();
69 if( ! tuple.getMicroOperations().contains( microOp ) )
70 {
71 retain = false;
72 break;
73 }
74 }
75
76 if( !retain )
77 {
78 i.remove();
79 }
80 }
81
82 return tuples;
83 }
84
85 }