[Lada-commits] [PATCH] Added owner attribute to probe listing
Wald Commits
scm-commit at wald.intevation.org
Fri Jul 10 14:54:28 CEST 2015
# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1436532861 -7200
# Node ID 51d8d5bacf687047b93cc092bc1aa202ce789aa8
# Parent cd22674b4673f56c9a2a7884463be269aea7bbdc
Added owner attribute to probe listing.
diff -r cd22674b4673 -r 51d8d5bacf68 src/main/java/de/intevation/lada/rest/ProbeService.java
--- 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());
}
More information about the Lada-commits
mailing list