diff src/main/java/de/intevation/lada/util/auth/HeaderAuthorization.java @ 800:8c336f08e76f

Addedd method to authorize a messung using the id and the status.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 19 Nov 2015 16:52:30 +0100
parents 64adf06df02f
children d0510a89e701
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/util/auth/HeaderAuthorization.java	Thu Nov 19 08:50:33 2015 +0100
+++ b/src/main/java/de/intevation/lada/util/auth/HeaderAuthorization.java	Thu Nov 19 16:52:30 2015 +0100
@@ -107,6 +107,28 @@
         return data;
     }
 
+    @Override
+    public <T> boolean isAuthorized(int id, Class<T> clazz) {
+        if (clazz == LMessung.class) {
+            LMessung messung = repository.getByIdPlain(
+                LMessung.class,
+                id,
+                "land");
+            if (messung.getStatus() == null) {
+                return false;
+            }
+            LStatusProtokoll status = repository.getByIdPlain(
+                LStatusProtokoll.class,
+                messung.getStatus(),
+                "land");
+            if (status.getStatusWert() == 0) {
+                return false;
+            }
+            return true;
+        }
+        return false;
+    }
+
     /**
      * Check whether a user is authorized to operate on the given data.
      *
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)