annotate src/main/java/de/intevation/lada/util/auth/UserInfo.java @ 963:0e9c4718196f

IDs should be equal, not just contain each other.
author Tom Gottfried <tom@intevation.de>
date Mon, 30 May 2016 15:01:08 +0200
parents 7fc536615624
children 1c41c7b8f7c2
rev   line source
711
3ec358698b4d Code style and documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 580
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
3ec358698b4d Code style and documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 580
diff changeset
2 * Software engineering by Intevation GmbH
3ec358698b4d Code style and documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 580
diff changeset
3 *
3ec358698b4d Code style and documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 580
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
3ec358698b4d Code style and documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 580
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
3ec358698b4d Code style and documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 580
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
3ec358698b4d Code style and documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 580
diff changeset
7 */
580
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8 package de.intevation.lada.util.auth;
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 import java.util.ArrayList;
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 import java.util.List;
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12
960
7fc536615624 Fixed authorization issues.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 906
diff changeset
13 import javax.inject.Inject;
7fc536615624 Fixed authorization issues.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 906
diff changeset
14
7fc536615624 Fixed authorization issues.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 906
diff changeset
15 import org.apache.log4j.Logger;
7fc536615624 Fixed authorization issues.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 906
diff changeset
16
838
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
17 import de.intevation.lada.model.stamm.Auth;
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
18
711
3ec358698b4d Code style and documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 580
diff changeset
19 /**
3ec358698b4d Code style and documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 580
diff changeset
20 * Container for user specific information.
3ec358698b4d Code style and documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 580
diff changeset
21 *
3ec358698b4d Code style and documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 580
diff changeset
22 * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
3ec358698b4d Code style and documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 580
diff changeset
23 */
580
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 public class UserInfo {
960
7fc536615624 Fixed authorization issues.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 906
diff changeset
25 private Logger logger = Logger.getLogger(UserInfo.class);
7fc536615624 Fixed authorization issues.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 906
diff changeset
26
580
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 private String name;
857
c481688150e8 Create a new user object if not exists and use user authorization for queries.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
28 private Integer userId;
580
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 private List<String> messstellen;
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 private List<String> netzbetreiber;
771
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
31 private List<Integer> funktionen;
838
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
32 private List<Auth> auth;
580
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33
894
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
34 public class MessLaborId {
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
35 private String messstelle;
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
36 private String labor;
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
37
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
38 /**
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
39 * @return the messstelle
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
40 */
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
41 public String getMessstelle() {
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
42 return messstelle;
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
43 }
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
44
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
45 /**
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
46 * @param messstelle the messstelle to set
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
47 */
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
48 public void setMessstelle(String messstelle) {
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
49 this.messstelle = messstelle;
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
50 }
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
51
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
52 /**
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
53 * @return the labor
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
54 */
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
55 public String getLabor() {
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
56 return labor;
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
57 }
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
58
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
59 /**
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
60 * @param labor the labor to set
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
61 */
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
62 public void setLabor(String labor) {
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
63 this.labor = labor;
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
64 }
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
65 }
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
66
580
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 public UserInfo() {
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 messstellen = new ArrayList<String>();
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 netzbetreiber = new ArrayList<String>();
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 }
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 /**
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 * @return the name
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 */
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 public String getName() {
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 return name;
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 }
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 /**
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 * @param name the name to set
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 */
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 public void setName(String name) {
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 this.name = name;
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 }
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 /**
857
c481688150e8 Create a new user object if not exists and use user authorization for queries.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
87 * @return the userId
c481688150e8 Create a new user object if not exists and use user authorization for queries.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
88 */
c481688150e8 Create a new user object if not exists and use user authorization for queries.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
89 public Integer getUserId() {
c481688150e8 Create a new user object if not exists and use user authorization for queries.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
90 return userId;
c481688150e8 Create a new user object if not exists and use user authorization for queries.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
91 }
c481688150e8 Create a new user object if not exists and use user authorization for queries.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
92
c481688150e8 Create a new user object if not exists and use user authorization for queries.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
93 /**
c481688150e8 Create a new user object if not exists and use user authorization for queries.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
94 * @param userId the userId to set
c481688150e8 Create a new user object if not exists and use user authorization for queries.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
95 */
c481688150e8 Create a new user object if not exists and use user authorization for queries.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
96 public void setUserId(Integer userId) {
c481688150e8 Create a new user object if not exists and use user authorization for queries.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
97 this.userId = userId;
c481688150e8 Create a new user object if not exists and use user authorization for queries.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
98 }
c481688150e8 Create a new user object if not exists and use user authorization for queries.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
99
894
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
100 public List<MessLaborId> getMessLaborId() {
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
101 List<MessLaborId> ret = new ArrayList<MessLaborId>();
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
102 for (Auth a : auth) {
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
103 if (a.getMstId() != null) {
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
104 MessLaborId id = new MessLaborId();
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
105 id.setMessstelle(a.getMstId());
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
106 id.setLabor(a.getLaborMstId());
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
107 ret.add(id);
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
108 }
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
109 }
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
110 return ret;
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
111 }
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
112
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
113 public boolean belongsTo(String messstelle, String labor) {
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
114 for (Auth a : auth) {
906
22052e4808c0 Fixed authorization. Avoids NPE for users/roles without mst_id
Raimund Renkert <raimund.renkert@intevation.de>
parents: 894
diff changeset
115 if (a.getMstId() == null) {
22052e4808c0 Fixed authorization. Avoids NPE for users/roles without mst_id
Raimund Renkert <raimund.renkert@intevation.de>
parents: 894
diff changeset
116 continue;
22052e4808c0 Fixed authorization. Avoids NPE for users/roles without mst_id
Raimund Renkert <raimund.renkert@intevation.de>
parents: 894
diff changeset
117 }
963
0e9c4718196f IDs should be equal, not just contain each other.
Tom Gottfried <tom@intevation.de>
parents: 960
diff changeset
118 if (a.getMstId().equals(messstelle)
0e9c4718196f IDs should be equal, not just contain each other.
Tom Gottfried <tom@intevation.de>
parents: 960
diff changeset
119 || (a.getLaborMstId() != null
0e9c4718196f IDs should be equal, not just contain each other.
Tom Gottfried <tom@intevation.de>
parents: 960
diff changeset
120 && a.getLaborMstId().equals(labor))) {
894
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
121 return true;
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
122 }
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
123 }
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
124 return false;
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
125 }
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
126
857
c481688150e8 Create a new user object if not exists and use user authorization for queries.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
127 /**
580
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
128 * @return the messstellen
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129 */
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 public List<String> getMessstellen() {
838
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
131 List<String> ret = new ArrayList<String>();
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
132 for (Auth a : auth) {
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
133 if (a.getMstId() != null) {
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
134 ret.add(a.getMstId());
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
135 }
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
136 }
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
137 return ret;
580
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
138 }
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
139
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
140 /**
894
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
141 * @return the labor messstellen
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
142 */
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
143 public List<String> getLaborMessstellen() {
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
144 List<String> ret = new ArrayList<String>();
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
145 for (Auth a : auth) {
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
146 if (a.getLaborMstId() != null) {
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
147 ret.add(a.getLaborMstId());
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
148 }
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
149 }
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
150 return ret;
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
151 }
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
152
f5b4784d9173 Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents: 892
diff changeset
153 /**
580
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
154 * @return the netzbetreiber
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
155 */
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
156 public List<String> getNetzbetreiber() {
838
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
157 List<String> ret = new ArrayList<String>();
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
158 for (Auth a : auth) {
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
159 if (a.getNetzbetreiberId() != null) {
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
160 ret.add(a.getNetzbetreiberId());
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
161 }
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
162 }
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
163 return ret;
580
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
164 }
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
165
838
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
166 public List<Integer> getFunktionen() {
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
167 List<Integer> ret = new ArrayList<Integer>();
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
168 for (Auth a : auth) {
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
169 if (a.getFunktionId() != null) {
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
170 ret.add(a.getFunktionId());
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
171 }
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
172 }
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
173 return ret;
580
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
174 }
771
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
175
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
176 /**
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
177 * @return the funktionen
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
178 */
838
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
179 public List<Integer> getFunktionenForMst(String mstId) {
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
180 List<Integer> ret = new ArrayList<Integer>();
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
181 for (Auth a : auth) {
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
182 if (a.getMstId() != null && a.getMstId().equals(mstId)) {
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
183 ret.add(a.getFunktionId());
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
184 }
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
185 }
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
186 return ret;
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
187 }
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
188
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
189 /**
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
190 * @return the funktionen
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
191 */
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
192 public List<Integer> getFunktionenForNetzbetreiber(String nId) {
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
193 List<Integer> ret = new ArrayList<Integer>();
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
194 for (Auth a : auth) {
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
195 if (a.getNetzbetreiberId() != null &&
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
196 a.getNetzbetreiberId().equals(nId)) {
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
197 ret.add(a.getFunktionId());
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
198 }
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
199 }
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
200 return ret;
771
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
201 }
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
202
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
203 /**
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
204 * @return the funktionen
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
205 */
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
206 public List<String> getFunktionenAsString() {
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
207 List<String> retVal = new ArrayList<String>();
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
208 for (int i = 0; i < this.funktionen.size(); i++) {
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
209 retVal.add(this.funktionen.get(i).toString());
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
210 }
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
211 return retVal;
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
212 }
244c54d16957 Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 711
diff changeset
213
838
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
214 public void setAuth(List<Auth> auth) {
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
215 this.auth = auth;
1ed347eb856b Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 771
diff changeset
216 }
580
b2db32812260 Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
217 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)