01: /* Copyright 2004 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.security.provider;
07:
08: import java.util.Enumeration;
09: import java.util.Map;
10:
11: import org.jasig.portal.EntityIdentifier;
12: import org.jasig.portal.security.IPerson;
13: import org.jasig.portal.security.ISecurityContext;
14:
15: /**
16: * An IPerson object that wraps another IPerson
17: * object and prevents access to the
18: * underlying sercurity context.
19: * @author Ken Weiner, kweiner@unicon.net
20: * @version $Revision: 36677 $
21: */
22: public class RestrictedPerson implements IPerson {
23:
24: private IPerson person;
25:
26: public RestrictedPerson(IPerson person) {
27: this .person = person;
28: }
29:
30: public Object getAttribute(String key) {
31: return this .person.getAttribute(key);
32: }
33:
34: public Object[] getAttributeValues(String key) {
35: return this .person.getAttributeValues(key);
36: }
37:
38: public Enumeration getAttributeNames() {
39: return this .person.getAttributeNames();
40: }
41:
42: public Enumeration getAttributes() {
43: return this .person.getAttributes();
44: }
45:
46: public String getFullName() {
47: return this .person.getFullName();
48: }
49:
50: public int getID() {
51: return this .person.getID();
52: }
53:
54: public boolean isGuest() {
55: return this .person.isGuest();
56: }
57:
58: public void setAttribute(String key, Object value) {
59: this .person.setAttribute(key, value);
60: }
61:
62: public void setAttributes(Map attrs) {
63: this .person.setAttributes(attrs);
64: }
65:
66: public void setFullName(String sFullName) {
67: this .person.setFullName(sFullName);
68: }
69:
70: public void setID(int sID) {
71: this .person.setID(sID);
72: }
73:
74: /**
75: * RestrictedPerson's implementation of getSecurityContext prevents
76: * access to the security context by always returning null.
77: * @return null
78: */
79: public ISecurityContext getSecurityContext() {
80: return null;
81: }
82:
83: /**
84: * RestrictedPerson's implementation of setSecurityContext does nothing.
85: */
86: public void setSecurityContext(ISecurityContext securityContext) {
87: // Part of RestrictedPerson's restrictedness is to do nothing
88: // when this method is invoked.
89: }
90:
91: public EntityIdentifier getEntityIdentifier() {
92: return this .person.getEntityIdentifier();
93: }
94:
95: public void setEntityIdentifier(final EntityIdentifier ei) {
96: // Nothing to do
97: }
98: }
|