diff src/main/java/de/intevation/lada/rest/MesswertService.java @ 833:fa922101a462

Refactored Authorization. * Introduced "authorizer" * Attribute and datatype depended authorization
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 08 Jan 2016 12:05:26 +0100
parents 5bdd1631a451
children 2fe625c91ab3
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/rest/MesswertService.java	Fri Dec 18 18:01:00 2015 +0100
+++ b/src/main/java/de/intevation/lada/rest/MesswertService.java	Fri Jan 08 12:05:26 2016 +0100
@@ -153,10 +153,13 @@
             LMessung.class,
             id,
             "land");
-        if (!authorization.isAuthorized(authorization.getInfo(request), messung)) {
-            if (!authorization.isAuthorized(id, LMessung.class)) {
-                return new Response(false, 697, null);
-            }
+        if (!authorization.isAuthorized(
+                request,
+                messung,
+                RequestMethod.GET,
+                LMessung.class)
+        ) {
+            return new Response(false, 697, null);
         }
         QueryBuilder<LMesswert> builder =
             new QueryBuilder<LMesswert>(
@@ -193,10 +196,13 @@
             LMessung.class,
             messwert.getMessungsId(),
             "land");
-        if (!authorization.isAuthorized(authorization.getInfo(request), messung)) {
-            if (!authorization.isAuthorized(messung.getId(), LMessung.class)) {
-                return new Response(false, 699, null);
-            }
+        if (!authorization.isAuthorized(
+            request,
+            messung,
+            RequestMethod.GET,
+            LMessung.class)
+        ) {
+            return new Response(false, 699, null);
         }
         Violation violation = validator.validate(messwert);
         if (violation.hasErrors() || violation.hasWarnings()) {
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)