001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *  
010 *    http://www.apache.org/licenses/LICENSE-2.0
011 *  
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License. 
018 *  
019 */
020package org.apache.directory.server.core.authz.support;
021
022
023import java.util.Collection;
024
025import org.apache.directory.api.ldap.aci.ACITuple;
026import org.apache.directory.api.ldap.aci.MicroOperation;
027import org.apache.directory.api.ldap.model.constants.AuthenticationLevel;
028import org.apache.directory.api.ldap.model.entry.Entry;
029import org.apache.directory.api.ldap.model.entry.Value;
030import org.apache.directory.api.ldap.model.name.Dn;
031import org.apache.directory.api.ldap.model.schema.AttributeType;
032import org.apache.directory.api.ldap.model.schema.SchemaManager;
033import org.apache.directory.server.core.api.interceptor.context.OperationContext;
034
035
036/**
037 * A container used to pass parameters to the ACDF engine
038 *
039 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
040 * @version $Rev$, $Date$
041 */
042public class AciContext
043{
044    /** The schema manager */
045    private SchemaManager schemaManager;
046
047    /** The operation context */
048    private OperationContext operationContext;
049
050    /** The Users belonging to a group */
051    private Collection<String> userGroupNames;
052
053    /** The user's Dn */
054    private Dn userDn;
055
056    /** The requested Authentication level (default to NONE) */
057    private AuthenticationLevel authenticationLevel = AuthenticationLevel.NONE;
058
059    /** the entry's Dn */
060    private Dn entryDn;
061
062    /** The AttributeType */
063    private AttributeType attributeType;
064
065    /** The attribute's values */
066    private Value attrValue;
067
068    /** The allowed operations */
069    private Collection<MicroOperation> microOperations;
070
071    /** The resulting tuples */
072    private Collection<ACITuple> aciTuples;
073
074    /** The entry */
075    private Entry entry;
076
077    /** ??? */
078    private Entry entryView;
079
080
081    /**
082     * Creates a new instance of AciContext.
083     *
084     * @param schemaManager The SchemaManager instance
085     * @param operationContext The OperationContext instance
086     */
087    public AciContext( SchemaManager schemaManager, OperationContext operationContext )
088    {
089        this.schemaManager = schemaManager;
090        this.operationContext = operationContext;
091    }
092
093
094    /**
095     * @return the schemaManager
096     */
097    public SchemaManager getSchemaManager()
098    {
099        return schemaManager;
100    }
101
102
103    /**
104     * @param schemaManager the schemaManager to set
105     */
106    public void setSchemaManager( SchemaManager schemaManager )
107    {
108        this.schemaManager = schemaManager;
109    }
110
111
112    /**
113     * @return the operationContext
114     */
115    public OperationContext getOperationContext()
116    {
117        return operationContext;
118    }
119
120
121    /**
122     * @param operationContext the operationContext to set
123     */
124    public void setOperationContext( OperationContext operationContext )
125    {
126        this.operationContext = operationContext;
127    }
128
129
130    /**
131     * @return the userGroupNames
132     */
133    public Collection<String> getUserGroupNames()
134    {
135        return userGroupNames;
136    }
137
138
139    /**
140     * @param userGroupNames the userGroupNames to set
141     */
142    public void setUserGroupNames( Collection<String> userGroupNames )
143    {
144        this.userGroupNames = userGroupNames;
145    }
146
147
148    /**
149     * @return the user Dn
150     */
151    public Dn getUserDn()
152    {
153        return userDn;
154    }
155
156
157    /**
158     * @param userDn the user Dn to set
159     */
160    public void setUserDn( Dn userDn )
161    {
162        this.userDn = userDn;
163    }
164
165
166    /**
167     * @return the authenticationLevel
168     */
169    public AuthenticationLevel getAuthenticationLevel()
170    {
171        return authenticationLevel;
172    }
173
174
175    /**
176     * @param authenticationLevel the authenticationLevel to set
177     */
178    public void setAuthenticationLevel( AuthenticationLevel authenticationLevel )
179    {
180        this.authenticationLevel = authenticationLevel;
181    }
182
183
184    /**
185     * @return the entry Dn
186     */
187    public Dn getEntryDn()
188    {
189        return entryDn;
190    }
191
192
193    /**
194     * @param entryDn the entry Dn to set
195     */
196    public void setEntryDn( Dn entryDn )
197    {
198        this.entryDn = entryDn;
199    }
200
201
202    /**
203     * @return the attributeType
204     */
205    public AttributeType getAttributeType()
206    {
207        return attributeType;
208    }
209
210
211    /**
212     * @param attributeType the attributeType to set
213     */
214    public void setAttributeType( AttributeType attributeType )
215    {
216        this.attributeType = attributeType;
217    }
218
219
220    /**
221     * @return the attrValue
222     */
223    public Value getAttrValue()
224    {
225        return attrValue;
226    }
227
228
229    /**
230     * @param attrValue the attrValue to set
231     */
232    public void setAttrValue( Value attrValue )
233    {
234        this.attrValue = attrValue;
235    }
236
237
238    /**
239     * @return the microOperations
240     */
241    public Collection<MicroOperation> getMicroOperations()
242    {
243        return microOperations;
244    }
245
246
247    /**
248     * @param microOperations the microOperations to set
249     */
250    public void setMicroOperations( Collection<MicroOperation> microOperations )
251    {
252        this.microOperations = microOperations;
253    }
254
255
256    /**
257     * @return the aciTuples
258     */
259    public Collection<ACITuple> getAciTuples()
260    {
261        return aciTuples;
262    }
263
264
265    /**
266     * @param aciTuples the aciTuples to set
267     */
268    public void setAciTuples( Collection<ACITuple> aciTuples )
269    {
270        this.aciTuples = aciTuples;
271    }
272
273
274    /**
275     * @return the entry
276     */
277    public Entry getEntry()
278    {
279        return entry;
280    }
281
282
283    /**
284     * @param entry the entry to set
285     */
286    public void setEntry( Entry entry )
287    {
288        this.entry = entry;
289    }
290
291
292    /**
293     * @return the entryView
294     */
295    public Entry getEntryView()
296    {
297        return entryView;
298    }
299
300
301    /**
302     * @param entryView the entryView to set
303     */
304    public void setEntryView( Entry entryView )
305    {
306        this.entryView = entryView;
307    }
308}