]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org/argeo/security/SimpleArgeoUser.java
Prepare next development cycle
[lgpl/argeo-commons.git] / org / argeo / security / SimpleArgeoUser.java
1 /*
2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.argeo.security;
18
19 import java.io.Serializable;
20 import java.util.ArrayList;
21 import java.util.HashMap;
22 import java.util.List;
23 import java.util.Map;
24
25 public class SimpleArgeoUser implements ArgeoUser, Serializable {
26 private static final long serialVersionUID = 1L;
27
28 private String username;
29 private String password;
30 private Map<String, UserNature> userNatures = new HashMap<String, UserNature>();
31 private List<String> roles = new ArrayList<String>();
32
33 public SimpleArgeoUser() {
34
35 }
36
37 public SimpleArgeoUser(ArgeoUser argeoUser) {
38 username = argeoUser.getUsername();
39 password = argeoUser.getPassword();
40 userNatures = new HashMap<String, UserNature>(
41 argeoUser.getUserNatures());
42 roles = new ArrayList<String>(argeoUser.getRoles());
43 }
44
45 public Map<String, UserNature> getUserNatures() {
46 return userNatures;
47 }
48
49 public void updateUserNatures(Map<String, UserNature> userNaturesData) {
50 UserNature.updateUserNaturesWithCheck(userNatures, userNaturesData);
51 }
52
53 public List<String> getRoles() {
54 return roles;
55 }
56
57 public String getUsername() {
58 return username;
59 }
60
61 public void setUsername(String username) {
62 this.username = username;
63 }
64
65 public void setUserNatures(Map<String, UserNature> userNatures) {
66 this.userNatures = userNatures;
67 }
68
69 public void setRoles(List<String> roles) {
70 this.roles = roles;
71 }
72
73 public String getPassword() {
74 return password;
75 }
76
77 public void setPassword(String password) {
78 this.password = password;
79 }
80 }