diff src/main/java/de/intevation/lada/rest/ProbeService.java @ 1332:65ed13ff9945 2.6.1

Changed authorization for Messprogramm. * Added 'readonly' flag * Only user with function '4' and the corresponding 'netzbetreiber' are allowed to edit. * User authorized to create a 'probe' are allowed to generate proben.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 29 Mar 2017 14:25:56 +0200
parents 14876c62f692
children
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/rest/ProbeService.java	Mon Mar 27 17:04:32 2017 +0200
+++ b/src/main/java/de/intevation/lada/rest/ProbeService.java	Wed Mar 29 14:25:56 2017 +0200
@@ -356,14 +356,15 @@
         if (messprogramm == null) {
             return new Response(false, 600, null);
         }
-
-        /* Allow generation of Probe objects only for a Messprogramm
-         * that would be allowed to be changed. */
+        // Use a dummy probe with same mstId as the messprogramm to authorize
+        // the user to create probe objects.
+        Probe testProbe = new Probe();
+        testProbe.setMstId(messprogramm.getMstId());
         if (!authorization.isAuthorized(
                 request,
-                messprogramm,
-                RequestMethod.PUT,
-                Messprogramm.class)
+                testProbe,
+                RequestMethod.POST,
+                Probe.class)
         ) {
             return new Response(false, 699, null);
         }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)