View Javadoc

1   /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
2    *
3    * Licensed under the Apache License, Version 2.0 (the "License");
4    * you may not use this file except in compliance with the License.
5    * You may obtain a copy of the License at
6    *
7    *     http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * 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  /**
22   * Indicates a class can process a given domain object instance and
23   * authoritatively return the ACLs that apply.
24   *
25   * <P>
26   * Implementations are typically called from the {@link AclProviderManager}.
27   * </p>
28   *
29   * @author Ben Alex
30   * @version $Id: AclProvider.java 1784 2007-02-24 21:00:24Z luke_t $
31   */
32  public interface AclProvider {
33      //~ Methods ========================================================================================================
34  
35      /**
36       * Obtains the ACLs that apply to the specified domain instance.<P>Will never be called unless the {@link
37       * #supports(Object)} method returned <code>true</code>.</p>
38       *
39       * @param domainInstance the instance for which ACL information is required (never <code>null</code>)
40       *
41       * @return the ACLs that apply, or <code>null</code> if no ACLs apply to the specified domain instance
42       */
43      AclEntry[] getAcls(Object domainInstance);
44  
45      /**
46       * Obtains the ACLs that apply to the specified domain instance and presented <code>Authentication</code>
47       * object.<P>Will never be called unless the {@link #supports(Object)} method returned <code>true</code>.</p>
48       *
49       * @param domainInstance the instance for which ACL information is required (never <code>null</code>)
50       * @param authentication the prncipal for which ACL information should be filtered (never <code>null</code>)
51       *
52       * @return only those ACLs applying to the domain instance that have been granted to the principal (or
53       *         <code>null</code>) if no such ACLs are found
54       */
55      AclEntry[] getAcls(Object domainInstance, 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  }