01: /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
02: *
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * Unless required by applicable law or agreed to in writing, software
10: * distributed under the License is distributed on an "AS IS" BASIS,
11: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: * See the License for the specific language governing permissions and
13: * limitations under the License.
14: */
15:
16: package org.acegisecurity.acl;
17:
18: import org.acegisecurity.Authentication;
19:
20: /**
21: * Indicates a class can process a given domain object instance and
22: * authoritatively return the ACLs that apply.
23: *
24: * <P>
25: * Implementations are typically called from the {@link AclProviderManager}.
26: * </p>
27: *
28: * @author Ben Alex
29: * @version $Id: AclProvider.java 1784 2007-02-24 21:00:24Z luke_t $
30: */
31: public interface AclProvider {
32: //~ Methods ========================================================================================================
33:
34: /**
35: * Obtains the ACLs that apply to the specified domain instance.<P>Will never be called unless the {@link
36: * #supports(Object)} method returned <code>true</code>.</p>
37: *
38: * @param domainInstance the instance for which ACL information is required (never <code>null</code>)
39: *
40: * @return the ACLs that apply, or <code>null</code> if no ACLs apply to the specified domain instance
41: */
42: AclEntry[] getAcls(Object domainInstance);
43:
44: /**
45: * Obtains the ACLs that apply to the specified domain instance and presented <code>Authentication</code>
46: * object.<P>Will never be called unless the {@link #supports(Object)} method returned <code>true</code>.</p>
47: *
48: * @param domainInstance the instance for which ACL information is required (never <code>null</code>)
49: * @param authentication the prncipal for which ACL information should be filtered (never <code>null</code>)
50: *
51: * @return only those ACLs applying to the domain instance that have been granted to the principal (or
52: * <code>null</code>) if no such ACLs are found
53: */
54: AclEntry[] getAcls(Object domainInstance,
55: Authentication authentication);
56:
57: /**
58: * Indicates whether this <code>AclProvider</code> can authoritatively return ACL information for the
59: * specified domain object instance.
60: *
61: * @param domainInstance the instance for which ACL information is required (never <code>null</code>)
62: *
63: * @return <code>true</code> if this provider is authoritative for the specified domain object instance,
64: * <code>false</code> otherwise
65: */
66: boolean supports(Object domainInstance);
67: }
|