changeset 699:51d8d5bacf68

Added owner attribute to probe listing.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 10 Jul 2015 14:54:21 +0200 (2015-07-10)
parents cd22674b4673
children d74b5b1190ae
files src/main/java/de/intevation/lada/rest/ProbeService.java
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/rest/ProbeService.java	Fri Jul 10 14:03:56 2015 +0200
+++ b/src/main/java/de/intevation/lada/rest/ProbeService.java	Fri Jul 10 14:54:21 2015 +0200
@@ -49,6 +49,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;
@@ -235,6 +236,13 @@
                 boolean readOnly =
                     authorization.isReadOnly((Integer)entry.get("id"));
                 entry.put("readonly", readOnly);
+                UserInfo ui = authorization.getInfo(request);
+                QueryBuilder<LProbe> builder = new QueryBuilder<LProbe>(
+                    defaultRepo.entityManager("land"), LProbe.class);
+                builder.and("id", (Integer)entry.get("id"));
+                Response r = defaultRepo.filter(builder.getQuery(), "land");
+                List<LProbe> probe = (List<LProbe>)r.getData();
+                entry.put("owner", authorization.isAuthorized(ui, probe.get(0)));
             }
             return new Response(true, 200, subList, result.size());
         }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)