[Lada-commits] [PATCH] MessungAuthorizer decides about statusEdit

Wald Commits scm-commit at wald.intevation.org
Fri Feb 5 14:51:41 CET 2016


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1454680274 -3600
# Node ID 186d30e5b44ae5d3ec56b3845377e49d6c513f77
# Parent  cbf6a15115dc63d64f43a670402a5706f447d396
MessungAuthorizer decides about statusEdit.

Removed code prevented setting any Status after Rückfrage.

diff -r cbf6a15115dc -r 186d30e5b44a src/main/java/de/intevation/lada/rest/stamm/StatusWertService.java
--- a/src/main/java/de/intevation/lada/rest/stamm/StatusWertService.java	Thu Feb 04 17:29:32 2016 +0100
+++ b/src/main/java/de/intevation/lada/rest/stamm/StatusWertService.java	Fri Feb 05 14:51:14 2016 +0100
@@ -35,7 +35,6 @@
 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;
@@ -101,9 +100,8 @@
         if (params.isEmpty() || !params.containsKey("messungsId")) {
             return defaultRepo.getAll(StatusWert.class, "stamm");
         }
-        UserInfo user = authorization.getInfo(request);
         int messungsId = Integer.valueOf(params.getFirst("messungsId"));
-        List<StatusWert> werte = getReachable(messungsId, user);
+        List<StatusWert> werte = getReachable(messungsId);
         Response response = new Response(true, 200, werte);
         return response;
     }
@@ -130,7 +128,7 @@
             "stamm");
     }
 
-    private List<StatusWert> getReachable(int messungsId, UserInfo user) {
+    private List<StatusWert> getReachable(int messungsId) {
         List<StatusWert> list = new ArrayList<StatusWert>();
         LMessung messung =
             defaultRepo.getByIdPlain(LMessung.class, messungsId, "land");
@@ -141,23 +139,15 @@
             StatusProtokoll.class,
             messung.getStatus(),
             "land");
-        boolean allowed = false;
-        for (int i = 0; i < user.getFunktionen().size(); i++) {
-            if (user.getFunktionen().get(i) >= status.getStatusStufe()) {
-                allowed = true;
-                break;
-            }
-        }
-        if (!allowed) {
-            return list;
-        }
+
         QueryBuilder<StatusErreichbar> errFilter =
             new QueryBuilder<StatusErreichbar>(
                 defaultRepo.entityManager("stamm"),
                 StatusErreichbar.class);
         errFilter.and("curStufe", status.getStatusStufe());
         errFilter.and("curWert", status.getStatusWert());
-        List<StatusErreichbar> erreichbare = defaultRepo.filterPlain(errFilter.getQuery(), "stamm");
+        List<StatusErreichbar> erreichbare = defaultRepo.filterPlain(
+            errFilter.getQuery(), "stamm");
         QueryBuilder<StatusWert> werteFilter =
             new QueryBuilder<StatusWert>(
                 defaultRepo.entityManager("stamm"),


More information about the Lada-commits mailing list