changeset 1266:e4cb532fde82

Filter orte by netzbetreiber.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 27 Jan 2017 15:14:53 +0100
parents a1323ef2c330
children 38059e566aba
files src/main/java/de/intevation/lada/rest/stamm/OrtService.java
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/rest/stamm/OrtService.java	Fri Jan 27 15:14:12 2017 +0100
+++ b/src/main/java/de/intevation/lada/rest/stamm/OrtService.java	Fri Jan 27 15:14:53 2017 +0100
@@ -34,6 +34,7 @@
 import de.intevation.lada.util.annotation.RepositoryConfig;
 import de.intevation.lada.util.auth.Authorization;
 import de.intevation.lada.util.auth.AuthorizationType;
+import de.intevation.lada.util.auth.UserInfo;
 import de.intevation.lada.util.data.QueryBuilder;
 import de.intevation.lada.util.data.Repository;
 import de.intevation.lada.util.data.RepositoryType;
@@ -180,7 +181,16 @@
             orte = repository.filterPlain(builder.getQuery(), "stamm");
         }
         else {
-            orte = repository.getAllPlain(Ort.class, "stamm");
+            UserInfo user = authorization.getInfo(request);
+            QueryBuilder<Ort> builder =
+                new QueryBuilder<Ort>(
+                    repository.entityManager("stamm"),
+                    Ort.class
+                );
+            for (String nb : user.getNetzbetreiber()) {
+               builder.or("netzbetreiberId", nb);
+            }
+            orte = repository.filterPlain(builder.getQuery(), "stamm");
         }
 
         int size = orte.size();
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)