01: package com.jat.business.privileges;
02:
03: import java.util.Enumeration;
04:
05: import com.jat.business.BusinessObject;
06: import com.jat.business.BusinessObjectList;
07: import com.jat.business.BusinessObjectProperties;
08: import com.jat.business.BusinessObjectPropertyList;
09: import com.jat.business.JatUser;
10:
11: /**
12: * <p>Title: JAT</p>
13: * <p>Description: </p>
14: * <p>Copyright: Copyright (c) 2004 -2005 Stefano Fratini (stefano.fratini@gmail.com)</p>
15: * <p>Distributed under the terms of the GNU Lesser General Public License, v2.1 or later</p>
16: * @author stf
17: * @version 1.0
18: * @since 1.2
19: */
20:
21: public class PrivilegeList extends BusinessObjectList {
22:
23: public PrivilegeList(String dataSourceName) {
24: super (dataSourceName);
25: }
26:
27: public boolean hasPrivilege(String functionality, JatUser user,
28: Object object) {
29: if (user.getProfile() == null)
30: return false;
31: for (Enumeration e = this .elements(); e.hasMoreElements();) {
32: Privilege priv = (Privilege) e.nextElement();
33: if (priv.hasPrivilege(functionality, user, object))
34: return true;
35: }
36: return false;
37: }
38:
39: public Enumeration privileges() {
40: return this .elements();
41: }
42:
43: protected PrivilegeList(String dataSourceName,
44: BusinessObjectPropertyList props) {
45: super (dataSourceName, props);
46: }
47:
48: protected BusinessObject getBusinessObject(
49: BusinessObjectProperties props) {
50: return new Privilege(super .getDataSourceName(), props);
51: }
52:
53: /** @link dependency
54: * @stereotype include*/
55: /*# Privilege lnkPrivilege; */
56: }
|