comparison src/main/java/de/intevation/lada/util/auth/HeaderAuthorization.java @ 838:1ed347eb856b statusworkflow

Use auth objects in user info to keep mst <-> function association.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 14 Jan 2016 10:21:19 +0100
parents d0510a89e701
children 2fe625c91ab3
comparison
equal deleted inserted replaced
823:de3a26d3f663 838:1ed347eb856b
63 public UserInfo getInfo(Object source) { 63 public UserInfo getInfo(Object source) {
64 if (source instanceof HttpServletRequest) { 64 if (source instanceof HttpServletRequest) {
65 HttpServletRequest request = (HttpServletRequest)source; 65 HttpServletRequest request = (HttpServletRequest)source;
66 String roleString = 66 String roleString =
67 request.getAttribute("lada.user.roles").toString(); 67 request.getAttribute("lada.user.roles").toString();
68 String[] roles = roleString.split(",");
69 UserInfo info = getGroupsFromDB(roleString); 68 UserInfo info = getGroupsFromDB(roleString);
70 info.setRoles(new ArrayList<String>(Arrays.asList(roles)));
71 info.setName(request.getAttribute("lada.user.name").toString()); 69 info.setName(request.getAttribute("lada.user.name").toString());
72 return info; 70 return info;
73 } 71 }
74 return null; 72 return null;
75 } 73 }
258 String[] mst = roles.split(","); 256 String[] mst = roles.split(",");
259 builder.andIn("ldapGroup", Arrays.asList(mst)); 257 builder.andIn("ldapGroup", Arrays.asList(mst));
260 Response response = repository.filter(builder.getQuery(), "stamm"); 258 Response response = repository.filter(builder.getQuery(), "stamm");
261 @SuppressWarnings("unchecked") 259 @SuppressWarnings("unchecked")
262 List<Auth> auth = (List<Auth>)response.getData(); 260 List<Auth> auth = (List<Auth>)response.getData();
263 List<String> netzbetreiber = new ArrayList<String>();
264 List<String> messstellen = new ArrayList<String>();
265 List<Integer> funktionen = new ArrayList<Integer>();
266 for (Auth a : auth) {
267 if (a.getNetzbetreiberId() != null) {
268 netzbetreiber.add(a.getNetzbetreiberId());
269 }
270 if (a.getMstId() != null) {
271 messstellen.add(a.getMstId());
272 }
273 if (a.getLaborMstId() != null) {
274 messstellen.add(a.getLaborMstId());
275 }
276 if (a.getFunktionId() != null) {
277 funktionen.add(a.getFunktionId());
278 }
279 }
280 UserInfo userInfo = new UserInfo(); 261 UserInfo userInfo = new UserInfo();
281 userInfo.setNetzbetreiber(netzbetreiber); 262 userInfo.setAuth(auth);
282 userInfo.setMessstellen(messstellen);
283 userInfo.setFunktionen(funktionen);
284 return userInfo; 263 return userInfo;
285 } 264 }
286 265
287 /** 266 /**
288 * Authorize data that has a messungsId Attribute. 267 * Authorize data that has a messungsId Attribute.
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)