KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > business > addressbook > right > AddressBookRights


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * -----------------------------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General Public License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General Public License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * -----------------------------------------------------------------------------
30  * $Log: AddressBookRights.java,v $
31  * Revision 1.2 2005/04/09 17:19:08 colinmacleod
32  * Changed copyright text to GPL v2 explicitly.
33  *
34  * Revision 1.1.1.1 2005/03/10 17:50:21 colinmacleod
35  * Restructured ivata op around Hibernate/PicoContainer.
36  * Renamed ivata groupware.
37  *
38  * Revision 1.4 2004/11/12 18:17:10 colinmacleod
39  * Ordered imports.
40  *
41  * Revision 1.3 2004/11/12 15:57:06 colinmacleod
42  * Removed dependencies on SSLEXT.
43  * Moved Persistence classes to ivata masks.
44  *
45  * Revision 1.2 2004/11/03 15:34:42 colinmacleod
46  * Changed todo comments to all caps.
47  *
48  * Revision 1.1 2004/07/13 19:41:14 colinmacleod
49  * Moved project to POJOs from EJBs.
50  * Applied PicoContainer to services layer (replacing session EJBs).
51  * Applied Hibernate to persistence layer (replacing entity EJBs).
52  * -----------------------------------------------------------------------------
53  */

54 package com.ivata.groupware.business.addressbook.right;
55
56 import java.util.Collection JavaDoc;
57
58 import com.ivata.groupware.admin.security.server.SecuritySession;
59 import com.ivata.groupware.business.addressbook.person.PersonDO;
60 import com.ivata.groupware.business.addressbook.person.employee.EmployeeDO;
61 import com.ivata.groupware.business.addressbook.person.group.GroupDO;
62 import com.ivata.mask.util.SystemException;
63
64 /**
65  * @author Colin MacLeod
66  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
67  * @since Apr 18, 2004
68  * @version $Revision: 1.2 $
69  */

70 public interface AddressBookRights {
71     /**
72      * <p>Change user rights for group.</p>
73      *
74      * @param id of group
75      * @param rights collection of group ids which will have ACCESS right to that group
76      * @param set to one of the <code>ACCESS_...</code> constants in <code>RightConstants</code>.
77      */

78     public abstract void amendRightsForGroup(
79         SecuritySession securitySession,
80         GroupDO group,
81         Collection JavaDoc rights,
82         Integer JavaDoc access)
83         throws SystemException;
84     /**
85      * <p>TODO: add a comment here.</p>
86      */

87     public abstract boolean canAddEmployeeToPerson(
88         SecuritySession securitySession,
89         PersonDO person)
90         throws SystemException;
91     /**
92      * <p>Find out if a used is allowed to add entries to a given group.</p>
93      *
94      * @param userName the name of the user to check the user rights for.
95      * @param groupId the unique identifier of the group to check.
96      * @return <code>true</code> if the user is entitled to add to the group,
97      * otherwise <code>false</code>.
98      */

99     public abstract boolean canAddToGroup(
100         SecuritySession securitySession,
101         GroupDO group)
102         throws SystemException;
103     /**
104      * <p>TODO: add a comment here.</p>
105      */

106     public abstract boolean canAmendEmployee(
107         SecuritySession securitySession,
108         EmployeeDO employeeDO)
109         throws SystemException;
110     /**
111      * <p>Find out if a used is allowed to amend entries in a given group.</p>
112      *
113      * @param userName the name of the user to check the user rights for.
114      * @param groupId the unique identifier of the group to check.
115      * @return <code>true</code> if the user is entitled to amend entries in the
116      * group, otherwise <code>false</code>.
117      */

118     public abstract boolean canAmendInGroup(
119         SecuritySession securitySession,
120         GroupDO group)
121         throws SystemException;
122     /**
123      * <p>TODO: add a comment here.</p>
124      */

125     public abstract boolean canRemoveEmployee(
126         SecuritySession securitySession,
127         EmployeeDO employeeDO)
128         throws SystemException;
129     /**
130      * <p>Find out if a used is allowed to remove entries from a given group.</p>
131      *
132      * @param userName the name of the user to check the user rights for.
133      * @param groupId the unique identifier of the group to check.
134      * @return <code>true</code> if the user is entitled to remove from the
135      * group, otherwise <code>false</code>.
136      */

137     public abstract boolean canRemoveFromGroup(
138         SecuritySession securitySession,
139         GroupDO group)
140         throws SystemException;
141     /**
142      * <p>Internal helper method. Find out if a user is allowed to access
143      * entries in a given group.</p>
144      *
145      * @param userName the name of the user to check the user rights for.
146      * @param groupId the unique identifier of the group to check.
147      * @param access the access level as defined in {@link
148      * com.ivata.groupware.business.addressbook.person.group.right.RightConstants
149      * RightConstants}.
150      * @return <code>true</code> if the user is entitled to access entries in the
151      * group, otherwise <code>false</code>.
152      */

153     public abstract boolean canUser(
154         SecuritySession securitySession,
155         GroupDO group,
156         Integer JavaDoc access)
157         throws SystemException;
158     /**
159      * <p>Find the unique identifiers of all addressBooks which can be accessed by the
160      * group specified, with the access level given.</p>
161      *
162      * @param groupId unique identifier of the group for which to search for
163      * other groups.
164      * @param access the access level as defined in {@link
165      * com.ivata.groupware.business.addressbook.person.group.right.RightConstants
166      * RightConstants}.
167      * @return a <code>Collection</code> of <code>Integer</code> instances,
168      * matching all groups which can be access with this level of access
169      * by the group specified.
170      */

171     public abstract Collection JavaDoc findAddressBooksByGroupAccess(
172         SecuritySession securitySession,
173         GroupDO group,
174         Integer JavaDoc access)
175         throws SystemException;
176     /**
177      * <p>Find groups which have <code>access</code> to group.
178      * Return only those groups which can be see by that user.</p>
179      *
180      * @param userName user which is trying find rights
181      * @param id of group which we are interesting
182      * @param access find rights with this access
183      * @return Collection of IDS of groups which have <code>access</code> to that group
184      */

185     public abstract Collection JavaDoc findRightsForGroup(
186         SecuritySession securitySession,
187         GroupDO group,
188         Integer JavaDoc access)
189         throws SystemException;
190 }
Popular Tags