Mercurial > lada > lada-server
comparison src/main/java/de/intevation/lada/util/auth/HeaderAuthorization.java @ 840:2fe625c91ab3
Merged branches.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 21 Jan 2016 09:01:57 +0100 |
parents | fa922101a462 1ed347eb856b |
children | c481688150e8 |
comparison
equal
deleted
inserted
replaced
837:9dd9a3de7a61 | 840:2fe625c91ab3 |
---|---|
90 public UserInfo getInfo(Object source) { | 90 public UserInfo getInfo(Object source) { |
91 if (source instanceof HttpServletRequest) { | 91 if (source instanceof HttpServletRequest) { |
92 HttpServletRequest request = (HttpServletRequest)source; | 92 HttpServletRequest request = (HttpServletRequest)source; |
93 String roleString = | 93 String roleString = |
94 request.getAttribute("lada.user.roles").toString(); | 94 request.getAttribute("lada.user.roles").toString(); |
95 String[] roles = roleString.split(","); | |
96 UserInfo info = getGroupsFromDB(roleString); | 95 UserInfo info = getGroupsFromDB(roleString); |
97 info.setRoles(new ArrayList<String>(Arrays.asList(roles))); | |
98 info.setName(request.getAttribute("lada.user.name").toString()); | 96 info.setName(request.getAttribute("lada.user.name").toString()); |
99 return info; | 97 return info; |
100 } | 98 } |
101 return null; | 99 return null; |
102 } | 100 } |
168 String[] mst = roles.split(","); | 166 String[] mst = roles.split(","); |
169 builder.andIn("ldapGroup", Arrays.asList(mst)); | 167 builder.andIn("ldapGroup", Arrays.asList(mst)); |
170 Response response = repository.filter(builder.getQuery(), "stamm"); | 168 Response response = repository.filter(builder.getQuery(), "stamm"); |
171 @SuppressWarnings("unchecked") | 169 @SuppressWarnings("unchecked") |
172 List<Auth> auth = (List<Auth>)response.getData(); | 170 List<Auth> auth = (List<Auth>)response.getData(); |
173 List<String> netzbetreiber = new ArrayList<String>(); | |
174 List<String> messstellen = new ArrayList<String>(); | |
175 List<Integer> funktionen = new ArrayList<Integer>(); | |
176 for (Auth a : auth) { | |
177 if (a.getNetzbetreiberId() != null) { | |
178 netzbetreiber.add(a.getNetzbetreiberId()); | |
179 } | |
180 if (a.getMstId() != null) { | |
181 messstellen.add(a.getMstId()); | |
182 } | |
183 if (a.getLaborMstId() != null) { | |
184 messstellen.add(a.getLaborMstId()); | |
185 } | |
186 if (a.getFunktionId() != null) { | |
187 funktionen.add(a.getFunktionId()); | |
188 } | |
189 } | |
190 UserInfo userInfo = new UserInfo(); | 171 UserInfo userInfo = new UserInfo(); |
191 userInfo.setNetzbetreiber(netzbetreiber); | 172 userInfo.setAuth(auth); |
192 userInfo.setMessstellen(messstellen); | |
193 userInfo.setFunktionen(funktionen); | |
194 return userInfo; | 173 return userInfo; |
195 } | 174 } |
196 | 175 |
197 /** | 176 /** |
198 * Test whether a probe is readonly. | 177 * Test whether a probe is readonly. |
211 Response response = repository.filter(builder.getQuery(), "land"); | 190 Response response = repository.filter(builder.getQuery(), "land"); |
212 @SuppressWarnings("unchecked") | 191 @SuppressWarnings("unchecked") |
213 List<LMessung> messungen = (List<LMessung>) response.getData(); | 192 List<LMessung> messungen = (List<LMessung>) response.getData(); |
214 for (int i = 0; i < messungen.size(); i++) { | 193 for (int i = 0; i < messungen.size(); i++) { |
215 if (messungen.get(i).getStatus() == null) { | 194 if (messungen.get(i).getStatus() == null) { |
216 return false; | 195 continue; |
217 } | 196 } |
218 LStatusProtokoll status = repository.getByIdPlain( | 197 LStatusProtokoll status = repository.getByIdPlain( |
219 LStatusProtokoll.class, messungen.get(i).getStatus(), "land"); | 198 LStatusProtokoll.class, messungen.get(i).getStatus(), "land"); |
220 if (status.getStatusWert() != 0 && status.getStatusWert() != 4) { | 199 if (status.getStatusWert() != 0 && status.getStatusWert() != 4) { |
221 return true; | 200 return true; |