# HG changeset patch # User Raimund Renkert # Date 1373966285 -7200 # Node ID 07c4186cbfab02cfcb9de5a8acc1943b6148ca80 # Parent 0de24f5e7c0179961db8d795624aa57b9dd7c42d Enable read access on all objects for authorized users. diff -r 0de24f5e7c01 -r 07c4186cbfab src/main/java/de/intevation/lada/rest/LKommentarMService.java --- a/src/main/java/de/intevation/lada/rest/LKommentarMService.java Tue Jul 16 08:24:34 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LKommentarMService.java Tue Jul 16 11:18:05 2013 +0200 @@ -79,15 +79,12 @@ return new Response(false, 609, new ArrayList()); } String probeId = params.getFirst("probeId"); - if (authentication.hasAccess(headers, probeId)) { - QueryBuilder builder = - new QueryBuilder( - repository.getEntityManager(), LKommentarM.class); - builder.and("probeId", probeId) - .and("messungsId", params.getFirst("messungsId")); - return repository.filter(builder.getQuery()); - } - return new Response(false, 698, new ArrayList()); + QueryBuilder builder = + new QueryBuilder( + repository.getEntityManager(), LKommentarM.class); + builder.and("probeId", probeId) + .and("messungsId", params.getFirst("messungsId")); + return repository.filter(builder.getQuery()); } catch(AuthenticationException ae) { return new Response(false, 699, new ArrayList()); diff -r 0de24f5e7c01 -r 07c4186cbfab src/main/java/de/intevation/lada/rest/LKommentarService.java --- a/src/main/java/de/intevation/lada/rest/LKommentarService.java Tue Jul 16 08:24:34 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LKommentarService.java Tue Jul 16 11:18:05 2013 +0200 @@ -118,14 +118,11 @@ return new Response(false, 609, new ArrayList()); } String probeId = params.getFirst("probeId"); - if (authentication.hasAccess(headers, probeId)) { - QueryBuilder builder = - new QueryBuilder( - repository.getEntityManager(), LKommentarP.class); - builder.and("probeId", probeId); - return repository.filter(builder.getQuery()); - } - return new Response(false, 698, new ArrayList()); + QueryBuilder builder = + new QueryBuilder( + repository.getEntityManager(), LKommentarP.class); + builder.and("probeId", probeId); + return repository.filter(builder.getQuery()); } catch(AuthenticationException ae) { return new Response(false, 699, new ArrayList()); diff -r 0de24f5e7c01 -r 07c4186cbfab src/main/java/de/intevation/lada/rest/LMessungService.java --- a/src/main/java/de/intevation/lada/rest/LMessungService.java Tue Jul 16 08:24:34 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LMessungService.java Tue Jul 16 11:18:05 2013 +0200 @@ -77,15 +77,12 @@ return new Response(false, 609, new ArrayList()); } String probeId = params.getFirst("probeId"); - if (authentication.hasAccess(headers, probeId)) { - QueryBuilder builder = - new QueryBuilder( - repository.getEntityManager(), - LMessung.class); - builder.and("probeId", probeId); - return repository.filter(builder.getQuery()); - } - return new Response(false, 698, new ArrayList()); + QueryBuilder builder = + new QueryBuilder( + repository.getEntityManager(), + LMessung.class); + builder.and("probeId", probeId); + return repository.filter(builder.getQuery()); } catch(AuthenticationException ae) { return new Response(false, 699, new ArrayList()); diff -r 0de24f5e7c01 -r 07c4186cbfab src/main/java/de/intevation/lada/rest/LMesswertService.java --- a/src/main/java/de/intevation/lada/rest/LMesswertService.java Tue Jul 16 08:24:34 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LMesswertService.java Tue Jul 16 11:18:05 2013 +0200 @@ -81,15 +81,12 @@ return new Response(false, 609, new ArrayList()); } String probeId = params.getFirst("probeId"); - if (authentication.hasAccess(headers, probeId)) { - QueryBuilder builder = - new QueryBuilder( - repository.getEntityManager(), LMesswert.class); - builder.and("probeId", probeId) - .and("messungsId", params.getFirst("messungsId")); - return repository.filter(builder.getQuery()); - } - return new Response(false, 698, new ArrayList()); + QueryBuilder builder = + new QueryBuilder( + repository.getEntityManager(), LMesswert.class); + builder.and("probeId", probeId) + .and("messungsId", params.getFirst("messungsId")); + return repository.filter(builder.getQuery()); } catch(AuthenticationException ae) { return new Response(false, 699, new ArrayList()); diff -r 0de24f5e7c01 -r 07c4186cbfab src/main/java/de/intevation/lada/rest/LOrtService.java --- a/src/main/java/de/intevation/lada/rest/LOrtService.java Tue Jul 16 08:24:34 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LOrtService.java Tue Jul 16 11:18:05 2013 +0200 @@ -80,21 +80,18 @@ return new Response(false, 609, new ArrayList()); } String probeId = params.getFirst("probeId"); - if (authentication.hasAccess(headers, probeId)) { - QueryBuilder builder = - new QueryBuilder( - repository.getEntityManager(), LOrt.class); - builder.and("probeId", probeId); - Response response = repository.filter(builder.getQuery()); - List list = (List) response.getData(); - boolean readonly = authorization.isReadOnly(probeId); - for (LOrt ort: list) { - ort.setReadonly(readonly); - } - response.setData(list); - return response; + QueryBuilder builder = + new QueryBuilder( + repository.getEntityManager(), LOrt.class); + builder.and("probeId", probeId); + Response response = repository.filter(builder.getQuery()); + List list = (List) response.getData(); + boolean readonly = authorization.isReadOnly(probeId); + for (LOrt ort: list) { + ort.setReadonly(readonly); } - return new Response(false, 698, new ArrayList()); + response.setData(list); + return response; } catch(AuthenticationException ae) { return new Response(false, 699, new ArrayList()); diff -r 0de24f5e7c01 -r 07c4186cbfab src/main/java/de/intevation/lada/rest/LStatusService.java --- a/src/main/java/de/intevation/lada/rest/LStatusService.java Tue Jul 16 08:24:34 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LStatusService.java Tue Jul 16 11:18:05 2013 +0200 @@ -76,15 +76,12 @@ return new Response(false, 609, new ArrayList()); } String probeId = params.getFirst("probeId"); - if (authentication.hasAccess(headers, probeId)) { - QueryBuilder builder = - new QueryBuilder( - repository.getEntityManager(), LStatus.class); - builder.and("probeId", probeId) - .and("messungsId", params.getFirst("messungsId")); - return repository.filter(builder.getQuery()); - } - return new Response(false, 698, new ArrayList()); + QueryBuilder builder = + new QueryBuilder( + repository.getEntityManager(), LStatus.class); + builder.and("probeId", probeId) + .and("messungsId", params.getFirst("messungsId")); + return repository.filter(builder.getQuery()); } catch(AuthenticationException ae) { return new Response(false, 699, new ArrayList()); diff -r 0de24f5e7c01 -r 07c4186cbfab src/main/java/de/intevation/lada/rest/LZusatzwertService.java --- a/src/main/java/de/intevation/lada/rest/LZusatzwertService.java Tue Jul 16 08:24:34 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LZusatzwertService.java Tue Jul 16 11:18:05 2013 +0200 @@ -73,14 +73,11 @@ return new Response(false, 609, new ArrayList()); } String probeId = params.getFirst("probeId"); - if (authentication.hasAccess(headers, probeId)) { - QueryBuilder builder = - new QueryBuilder( - repository.getEntityManager(), LZusatzWert.class); - builder.and("probeId", probeId); - return repository.filter(builder.getQuery()); - } - return new Response(false, 698, new ArrayList()); + QueryBuilder builder = + new QueryBuilder( + repository.getEntityManager(), LZusatzWert.class); + builder.and("probeId", probeId); + return repository.filter(builder.getQuery()); } catch(AuthenticationException ae) { return new Response(false, 699, new ArrayList());