View Javadoc

1   /**
2    * Copyright 2011-2013 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.mobility.security.authn.entity;
17  
18  import java.io.Serializable;
19  import java.util.ArrayList;
20  import java.util.List;
21  
22  import org.kuali.mobility.security.authn.util.AuthenticationConstants;
23  import org.kuali.mobility.security.authn.util.PersonAttributes;
24  
25  public class UserImpl implements User, Serializable {
26  
27  	private static final long serialVersionUID = -1437870897314265069L;
28  
29  	private String principalName;
30  	private String requestURL;
31  	
32  	private String viewCampus;
33  	
34  	private String email;
35  
36      private List<String> groups;
37      private PersonAttributes personAttributes;
38  
39      public UserImpl() {
40          this.groups = new ArrayList<String>();
41          this.personAttributes = new PersonAttributes();        
42      }
43      
44  	@Override
45  	public boolean isPublicUser() {
46  		if( this.getPrincipalName() == null
47  			|| "".equalsIgnoreCase(this.getPrincipalName())
48  			|| this.getPrincipalName().startsWith(AuthenticationConstants.PUBLIC_USER) )
49  		{
50  			return true;
51  		}
52  		else
53  		{
54  			return false;
55  		}
56  	}
57  
58  	@Override
59  	public void setPrincipalName(String userId) {
60  		this.principalName = userId;
61  	}
62  
63  	@Override
64  	public String getPrincipalName() {
65  		return this.principalName;
66  	}
67  
68  	@Override
69  	public void invalidateUser() {
70  		this.principalName = null;
71  	}
72  
73  	@Override
74  	public void setRequestURL(String url) {
75  		this.requestURL = url;
76  	}
77  
78  	@Override
79  	public String getRequestURL() {
80  		return this.requestURL;
81  	}
82  
83  	@Override
84  	public boolean isMember(String groupName) {
85  		return false;
86  	}
87  
88  	public String getViewCampus() {
89  		return viewCampus;
90  	}
91  
92  	public void setViewCampus(String viewCampus) {
93  		this.viewCampus = viewCampus;
94  	}
95  
96  	public String getEmail() {
97  		return email;
98  	}
99  
100 	public void setEmail(String email) {
101 		this.email = email;
102 	}
103     
104     public PersonAttributes getPersonAttributes() {
105         return personAttributes;
106     }
107 
108     public void setPersonAttributes(PersonAttributes personAttributes) {
109         this.personAttributes = personAttributes;
110     }
111     
112     public List<String> getGroups() {
113         return groups;
114     }
115 
116     public void setGroups(List<String> groups) {
117         this.groups = groups;
118     }
119     
120 }