KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > security > I_CmsPrincipal


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/security/I_CmsPrincipal.java,v $
3  * Date : $Date: 2006/03/27 14:52:48 $
4  * Version: $Revision: 1.15 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.security;
33
34 import org.opencms.util.CmsUUID;
35
36 import java.security.Principal JavaDoc;
37
38 /**
39  * Representation of an identity in the cms (currently user or group),
40  * used to define permissions on a resource.<p>
41  *
42  * @author Alexander Kandzior
43  * @author Carsten Weinholz
44  *
45  * @version $Revision: 1.15 $
46  *
47  * @since 6.0.0
48  */

49 public interface I_CmsPrincipal extends Principal JavaDoc {
50
51     /** Upper limit for core flags, any principal object with flags greater than this value will be filtered out. */
52     int FLAG_CORE_LIMIT = 65536; // 2^16
53

54     /** This flag is set for disabled principals in the database. */
55     int FLAG_DISABLED = 1;
56
57     /** This flag is set for enabled principals in the database. */
58     int FLAG_ENABLED = 0;
59
60     /** Flag to indicate a group is a potential project manager group. */
61     int FLAG_GROUP_PROJECT_MANAGER = 2;
62
63     /** Flag to indicate a group is a potential project user group. */
64     int FLAG_GROUP_PROJECT_USER = 4;
65
66     /** Flag to indicate a group is used as a role in the workflow. */
67     int FLAG_GROUP_WORKFLOW_ROLE = 8;
68
69     /** Identifier for group principals. */
70     String JavaDoc PRINCIPAL_GROUP = "GROUP";
71
72     /** Identifier for user principals. */
73     String JavaDoc PRINCIPAL_USER = "USER";
74
75     /**
76      * Checks if the provided principal name is valid and can be used as an argument value
77      * for {@link #setName(String)}.<p>
78      *
79      * @param name the principal name to check
80      */

81     void checkName(String JavaDoc name);
82
83     /**
84      * Compares the given object with this principal.<p>
85      *
86      * @param obj object to comapre
87      * @return true if the object is equal
88      */

89     boolean equals(Object JavaDoc obj);
90
91     /**
92      * Returns the description of this principal.<p>
93      *
94      * @return the description of this principal
95      */

96     String JavaDoc getDescription();
97
98     /**
99      * Returns the flags of this principal.<p>
100      *
101      * The principal flags are used to store special information about the
102      * principals state encoded bitwise. Usually the flags int value should not
103      * be directly accessed. Utility methods like <code>{@link #isEnabled()}</code>
104      * provide a much easier way to access the information contained in the flags.<p>
105      *
106      * @return the flags of this principal
107      */

108     int getFlags();
109
110     /**
111      * Returns the unique id of this principal.<p>
112      *
113      * @return the unique id of this principal
114      */

115     CmsUUID getId();
116
117     /**
118      * Returns the unique name of this principal.<p>
119      *
120      * @return the unique name of this principal
121      */

122     String JavaDoc getName();
123
124     /**
125      * Returns this principals unique name prefixed with it's type.<p>
126      *
127      * The type prefix can either be <code>{@link I_CmsPrincipal#PRINCIPAL_GROUP}.</code>
128      * (for groups) or <code>{@link I_CmsPrincipal#PRINCIPAL_USER}.</code> (for users).<p>
129      *
130      * @return this principals unique name prefixed with this principals type
131      */

132     String JavaDoc getPrefixedName();
133
134     /**
135      * Returns the hash code of this object.<p>
136      *
137      * @return the hash code
138      */

139     int hashCode();
140
141     /**
142      * Returns <code>true</code> if this principal is enabled.<p>
143      *
144      * A principal may be disabled in order to deactivate it, for example to prevent
145      * logins of a user. If a principal is just disabled but not deleted,
146      * the credentials of the principal in the VFS are still valid.<p>
147      *
148      * @return <code>true</code> if this principal is enabled
149      */

150     boolean isEnabled();
151
152     /**
153      * Returns <code>true</code> if this principal is of type <code>{@link org.opencms.file.CmsGroup}</code>.<p>
154      *
155      * @return <code>true</code> if this principal is of type <code>{@link org.opencms.file.CmsGroup}</code>
156      */

157     boolean isGroup();
158
159     /**
160      * Returns <code>true</code> if this principal is of type <code>{@link org.opencms.file.CmsUser}</code>.<p>
161      *
162      * @return <code>true</code> if this principal is of type <code>{@link org.opencms.file.CmsUser}</code>
163      */

164     boolean isUser();
165
166     /**
167      * Sets the description of this principal.<p>
168      *
169      * @param description the principal description to set
170      */

171     void setDescription(String JavaDoc description);
172
173     /**
174      * Enables (or disables) this principal, depending on the given status.<p>
175      *
176      * @param enabled the principal status to set
177      */

178     void setEnabled(boolean enabled);
179
180     /**
181      * Sets this principals flags to the specified value.<p>
182      *
183      * The principal flags are used to store special information about the
184      * principals state encoded bitwise. Usually the flags int value should not
185      * be directly accessed. Utility methods like <code>{@link #setEnabled(boolean)}</code>
186      * provide a much easier way to manipulate the information contained in the flags.<p>
187      *
188      * @param value the value to set this principals flags to
189      */

190     void setFlags(int value);
191
192     /**
193      * Sets the unique name of this principal.<p>
194      *
195      * @param name the unique name of this principal to set
196      */

197     void setName(String JavaDoc name);
198 }
Popular Tags