01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/metaobj/tags/sakai_2-4-1/metaobj-impl/api-impl/src/java/org/sakaiproject/metaobj/security/AnonymousAgent.java $
03: * $Id: AnonymousAgent.java 14225 2006-09-05 17:39:44Z chmaurer@iupui.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2004, 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.metaobj.security;
21:
22: import java.util.ArrayList;
23: import java.util.List;
24:
25: import org.sakaiproject.metaobj.shared.mgt.IdManagerImpl;
26: import org.sakaiproject.metaobj.shared.model.Agent;
27: import org.sakaiproject.metaobj.shared.model.Artifact;
28: import org.sakaiproject.metaobj.shared.model.Id;
29:
30: /**
31: * Created by IntelliJ IDEA.
32: * User: John Ellis
33: * Date: May 26, 2004
34: * Time: 10:36:46 AM
35: * To change this template use File | Settings | File Templates.
36: */
37: public class AnonymousAgent implements Agent {
38: public static Id ANONYMOUS_AGENT_ID = new IdManagerImpl()
39: .getId("anonymous");
40:
41: public Id getId() {
42: return ANONYMOUS_AGENT_ID;
43: }
44:
45: public Id getEid() {
46: return ANONYMOUS_AGENT_ID;
47: }
48:
49: public Artifact getProfile() {
50: return null;
51: }
52:
53: public void setProfile(Artifact profile) {
54:
55: }
56:
57: public Object getProperty(String key) {
58: return null;
59: }
60:
61: public String getDisplayName() {
62: return "anonymous";
63: }
64:
65: public boolean isInRole(String role) {
66: return role.equals(Agent.ROLE_ANONYMOUS);
67: }
68:
69: public boolean isInitialized() {
70: return true;
71: }
72:
73: public String getRole() {
74: return Agent.ROLE_ANONYMOUS;
75: }
76:
77: public List getWorksiteRoles(String worksiteId) {
78: return new ArrayList();
79: }
80:
81: public List getWorksiteRoles() {
82: return new ArrayList();
83: }
84:
85: public boolean isRole() {
86: return false;
87: }
88:
89: /**
90: * Returns the name of this principal.
91: *
92: * @return the name of this principal.
93: */
94: public String getName() {
95: return getDisplayName();
96: }
97: }
|