[Lada-commits] [PATCH] Fixed authorization issues

Wald Commits scm-commit at wald.intevation.org
Fri May 27 16:03:50 CEST 2016


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1464357820 -7200
# Node ID 7fc536615624164de2350f9eb0bd5566ef932ba4
# Parent  391ef3356b6091327f0103ca3ac4b77b01677fba
Fixed authorization issues.

diff -r 391ef3356b60 -r 7fc536615624 src/main/java/de/intevation/lada/util/auth/MessungAuthorizer.java
--- a/src/main/java/de/intevation/lada/util/auth/MessungAuthorizer.java	Thu May 26 12:20:15 2016 +0200
+++ b/src/main/java/de/intevation/lada/util/auth/MessungAuthorizer.java	Fri May 27 16:03:40 2016 +0200
@@ -116,22 +116,21 @@
                     repository.filterPlain(lstFilter.getQuery(), "stamm");
                 for (int i = 0; i < lsts.size(); i++) {
                     if (lsts.get(i).getUmwId().equals(probe.getUmwId())
-                        && status.getStatusStufe() == 2
-                        && status.getStatusWert() != 4
-                        || status.getStatusStufe() == 3
+                        && (status.getStatusStufe() == 2
+                        || status.getStatusStufe() == 3)
                     ) {
                         statusEdit = true;
                     }
                 }
             }
-            else if (userInfo.getFunktionen().contains(2) &&
+            if (userInfo.getFunktionenForNetzbetreiber(probe.getNetzbetreiberId()).contains(2) &&
                 userInfo.getNetzbetreiber().contains(probe.getNetzbetreiberId()) &&
                 (status.getStatusStufe() == 1 || status.getStatusStufe() == 2) &&
                 status.getStatusWert() >= 1
             ) {
                 statusEdit = true;
             }
-            else if (userInfo.getFunktionen().contains(1) &&
+            if (userInfo.getFunktionenForMst(probe.getMstId()).contains(1) &&
                 userInfo.belongsTo(probe.getMstId(), probe.getLaborMstId()) &&
                 (status.getStatusStufe() <= 1 || status.getStatusWert() == 4)
             ) {
diff -r 391ef3356b60 -r 7fc536615624 src/main/java/de/intevation/lada/util/auth/UserInfo.java
--- a/src/main/java/de/intevation/lada/util/auth/UserInfo.java	Thu May 26 12:20:15 2016 +0200
+++ b/src/main/java/de/intevation/lada/util/auth/UserInfo.java	Fri May 27 16:03:40 2016 +0200
@@ -10,6 +10,10 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+
 import de.intevation.lada.model.stamm.Auth;
 
 /**
@@ -18,6 +22,8 @@
  * @author <a href="mailto:rrenkert at intevation.de">Raimund Renkert</a>
  */
 public class UserInfo {
+    private Logger logger = Logger.getLogger(UserInfo.class);
+
     private String name;
     private Integer userId;
     private List<String> messstellen;
@@ -109,10 +115,10 @@
             if (a.getMstId() == null) {
                 continue;
             }
-            if (a.getMstId().contains(messstelle) &&
-                a.getLaborMstId() != null &&
+            if (a.getMstId().contains(messstelle) ||
+                (a.getLaborMstId() != null &&
                 labor != null &&
-                a.getLaborMstId().contains(labor)) {
+                a.getLaborMstId().contains(labor))) {
                 return true;
             }
         }


More information about the Lada-commits mailing list