Mercurial > lada > lada-server
annotate src/main/java/de/intevation/lada/util/auth/UserInfo.java @ 960:7fc536615624
Fixed authorization issues.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 27 May 2016 16:03:40 +0200 |
parents | 22052e4808c0 |
children | 0e9c4718196f |
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 } |
960
7fc536615624
Fixed authorization issues.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
906
diff
changeset
|
118 if (a.getMstId().contains(messstelle) || |
7fc536615624
Fixed authorization issues.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
906
diff
changeset
|
119 (a.getLaborMstId() != null && |
894
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
120 labor != null && |
960
7fc536615624
Fixed authorization issues.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
906
diff
changeset
|
121 a.getLaborMstId().contains(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
|
122 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
|
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 } |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
125 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
|
126 } |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
127 |
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
|
128 /** |
580
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
129 * @return the messstellen |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
130 */ |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
131 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
|
132 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
|
133 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
|
134 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
|
135 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
|
136 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
137 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
138 return ret; |
580
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 |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
141 /** |
894
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
142 * @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
|
143 */ |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
144 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
|
145 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
|
146 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
|
147 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
|
148 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
|
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 } |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
151 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
|
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 |
f5b4784d9173
Load probe attribute 'laborMstId' from db and use this field to authorize
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
154 /** |
580
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
155 * @return the netzbetreiber |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
156 */ |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
157 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
|
158 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
|
159 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
|
160 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
|
161 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
|
162 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
163 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
164 return ret; |
580
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
165 } |
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
166 |
838
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
167 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
|
168 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
|
169 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
|
170 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
|
171 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
|
172 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
173 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
174 return ret; |
580
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
175 } |
771
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 /** |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
178 * @return the funktionen |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
179 */ |
838
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
180 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
|
181 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
|
182 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
|
183 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
|
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; |
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 /** |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
191 * @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
|
192 */ |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
193 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
|
194 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
|
195 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
|
196 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
|
197 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
|
198 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
|
199 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
200 } |
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
201 return ret; |
771
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 /** |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
205 * @return the funktionen |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
206 */ |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
207 public List<String> getFunktionenAsString() { |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
208 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
|
209 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
|
210 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
|
211 } |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
212 return retVal; |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
213 } |
244c54d16957
Added fields for status and user roles/functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
711
diff
changeset
|
214 |
838
1ed347eb856b
Use auth objects in user info to keep mst <-> function association.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
771
diff
changeset
|
215 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
|
216 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
|
217 } |
580
b2db32812260
Added OpenId authorization and user info class.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
218 } |