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: package org.acegisecurity.acls;
16:
17: /**
18: * Represents a permission granted to a {@link org.acegisecurity.acls.sid.Sid Sid} for a given domain object.
19: *
20: * @author Ben Alex
21: * @version $Id: Permission.java 1784 2007-02-24 21:00:24Z luke_t $
22: */
23: public interface Permission {
24: //~ Static fields/initializers =====================================================================================
25:
26: char RESERVED_ON = '~';
27: char RESERVED_OFF = '.';
28: String THIRTY_TWO_RESERVED_OFF = "................................";
29:
30: //~ Methods ========================================================================================================
31:
32: /**
33: * Returns the bits that represents the permission.
34: *
35: * @return the bits that represent the permission
36: */
37: int getMask();
38:
39: /**
40: * Returns a 32-character long bit pattern <code>String</code> representing this permission.
41: * <p>
42: * Implementations are free to format the pattern as they see fit, although under no circumstances may
43: * {@link #RESERVED_OFF} or {@link #RESERVED_ON} be used within the pattern. An exemption is in the case of
44: * {@link #RESERVED_OFF} which is used to denote a bit that is off (clear).
45: * Implementations may also elect to use {@link #RESERVED_ON} internally for computation purposes,
46: * although this method may not return any <code>String</code> containing {@link #RESERVED_ON}.
47: * </p>
48: * <p>The returned String must be 32 characters in length.</p>
49: * <p>This method is only used for user interface and logging purposes. It is not used in any permission
50: * calculations. Therefore, duplication of characters within the output is permitted.</p>
51: *
52: * @return a 32-character bit pattern
53: */
54: String getPattern();
55: }
|