Mercurial > lada > lada-server
annotate src/main/java/de/intevation/lada/util/auth/UserInfo.java @ 1028:1c41c7b8f7c2 schema-update
Updated server application to new database model. THIS IS STILL WIP!!!
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 08 Jul 2016 15:32:36 +0200 |
parents | 0e9c4718196f |
children |
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 |
1028
1c41c7b8f7c2
Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents:
963
diff
changeset
|
13 import de.intevation.lada.model.stammdaten.Auth; |
838
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
14 |
711
3ec358698b4d
Code style and documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
580
diff
changeset
|
15 /** |
3ec358698b4d
Code style and documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
580
diff
changeset
|
16 * Container for user specific information. |
3ec358698b4d
Code style and documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
580
diff
changeset
|
17 * |
3ec358698b4d
Code style and documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
580
diff
changeset
|
18 * @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
|
19 */ |
580
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 public class UserInfo { |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 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
|
22 private Integer userId; |
771
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
23 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
|
24 private List<Auth> auth; |
580
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 |
894
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
26 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
|
27 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
|
28 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
|
29 |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
30 /** |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
31 * @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
|
32 */ |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
33 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
|
34 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
|
35 } |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
36 |
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 * @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
|
39 */ |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
40 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
|
41 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
|
42 } |
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 * @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
|
46 */ |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
47 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
|
48 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
|
49 } |
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 * @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
|
53 */ |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
54 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
|
55 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
|
56 } |
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 |
580
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 /** |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 * @return the name |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 */ |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 public String getName() { |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 return name; |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 } |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 /** |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 * @param name the name to set |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 */ |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 public void setName(String name) { |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 this.name = name; |
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 /** |
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
|
74 * @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
|
75 */ |
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
|
76 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
|
77 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
|
78 } |
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
|
79 |
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
|
80 /** |
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
|
81 * @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
|
82 */ |
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
|
83 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
|
84 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
|
85 } |
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
|
86 |
894
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
87 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
|
88 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
|
89 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
|
90 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
|
91 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
|
92 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
|
93 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
|
94 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
|
95 } |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
96 } |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
97 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
|
98 } |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
99 |
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 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
|
101 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
|
102 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
|
103 continue; |
22052e4808c0
Fixed authorization. Avoids NPE for users/roles without mst_id
Raimund Renkert <raimund.renkert@intevation.de>
parents:
894
diff
changeset
|
104 } |
963
0e9c4718196f
IDs should be equal, not just contain each other.
Tom Gottfried <tom@intevation.de>
parents:
960
diff
changeset
|
105 if (a.getMstId().equals(messstelle) |
0e9c4718196f
IDs should be equal, not just contain each other.
Tom Gottfried <tom@intevation.de>
parents:
960
diff
changeset
|
106 || (a.getLaborMstId() != null |
0e9c4718196f
IDs should be equal, not just contain each other.
Tom Gottfried <tom@intevation.de>
parents:
960
diff
changeset
|
107 && 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
|
108 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
|
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 } |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
111 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
|
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 |
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
|
114 /** |
580
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
115 * @return the messstellen |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
116 */ |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
117 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
|
118 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
|
119 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
|
120 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
|
121 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
|
122 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
123 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
124 return ret; |
580
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
125 } |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
126 |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
127 /** |
894
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
128 * @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
|
129 */ |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
130 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
|
131 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
|
132 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
|
133 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
|
134 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
|
135 } |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
136 } |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
137 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
|
138 } |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
139 |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
140 /** |
580
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
141 * @return the netzbetreiber |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
142 */ |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
143 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
|
144 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
|
145 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
|
146 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
|
147 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
|
148 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
149 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
150 return ret; |
580
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
151 } |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
152 |
838
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
153 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
|
154 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
|
155 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
|
156 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
|
157 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
|
158 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
159 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
160 return ret; |
580
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
161 } |
771
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
162 |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
163 /** |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
164 * @return the funktionen |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
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> 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
|
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.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
|
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; |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
174 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
175 |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
176 /** |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
177 * @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
|
178 */ |
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> 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
|
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.getNetzbetreiberId() != null && |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
183 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
|
184 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
|
185 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
186 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
187 return ret; |
771
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
188 } |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
189 |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
190 /** |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
191 * @return the funktionen |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
192 */ |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
193 public List<String> getFunktionenAsString() { |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
194 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
|
195 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
|
196 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
|
197 } |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
198 return retVal; |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
199 } |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
200 |
838
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
201 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
|
202 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
|
203 } |
580
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
204 } |