[Lada-commits] [PATCH 2 of 3] Explain with comments and remove conditions each applied by one above

Wald Commits scm-commit at wald.intevation.org
Wed Jun 1 15:29:04 CEST 2016


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1464617484 -7200
# Node ID 3c1b1631e4741365de3e6e58d90bf292fb5b45a8
# Parent  0e9c4718196f97efff461ac0d002190131be1b26
Explain with comments and remove conditions each applied by one above.

diff -r 0e9c4718196f -r 3c1b1631e474 src/main/java/de/intevation/lada/util/auth/MessungAuthorizer.java
--- a/src/main/java/de/intevation/lada/util/auth/MessungAuthorizer.java	Mon May 30 15:01:08 2016 +0200
+++ b/src/main/java/de/intevation/lada/util/auth/MessungAuthorizer.java	Mon May 30 16:11:24 2016 +0200
@@ -109,6 +109,9 @@
             messung.setReadonly(wert != 0 && wert != 4);
 
             boolean statusEdit = false;
+
+            /* Does the user belong to an appropriate 'Leitstelle' to
+               edit status? */
             if (userInfo.getFunktionen().contains(3)) {
                 QueryBuilder<AuthLstUmw> lstFilter = new QueryBuilder<AuthLstUmw>(
                     repository.entityManager("stamm"),
@@ -124,22 +127,23 @@
                     }
                 }
             }
+
+            // Has the user the right to edit status for the 'Netzbetreiber'?
             if (userInfo.getFunktionenForNetzbetreiber(
                     probe.getNetzbetreiberId()).contains(2)
-                && userInfo.getNetzbetreiber().contains(
-                    probe.getNetzbetreiberId())
                 && (stufe == 1 || stufe == 2)
                 && wert >= 1
             ) {
                 statusEdit = true;
             }
+
+            // Has the user the right to edit status for the 'Messstelle'?
             if (userInfo.getFunktionenForMst(probe.getMstId()).contains(1)
-                && userInfo.belongsTo(probe.getMstId(),
-                    probe.getLaborMstId())
                 && (stufe <= 1 || wert == 4)
             ) {
                 statusEdit = true;
             }
+
             messung.setStatusEdit(statusEdit);
 
         }


More information about the Lada-commits mailing list