# HG changeset patch # User Raimund Renkert # Date 1430403901 -7200 # Node ID bd4099d42d83c87c653f234e84d560ea1bd6f3f9 # Parent e0484b03981234bcbb29ebb23dded06af5474cd9 Added authorization class for test env. diff -r e0484b039812 -r bd4099d42d83 src/main/java/de/intevation/lada/util/auth/TestAuthorization.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/intevation/lada/util/auth/TestAuthorization.java Thu Apr 30 16:25:01 2015 +0200 @@ -0,0 +1,61 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ +package de.intevation.lada.util.auth; + +import java.util.ArrayList; +import java.util.List; + +import de.intevation.lada.util.annotation.AuthorizationConfig; +import de.intevation.lada.util.rest.RequestMethod; +import de.intevation.lada.util.rest.Response; + +@AuthorizationConfig(type=AuthorizationType.OPEN_ID) +public class TestAuthorization implements Authorization { + + @Override + public UserInfo getInfo(Object source) { + UserInfo info = new UserInfo(); + info.setName("testeins"); + List roles = new ArrayList(); + roles.add("mst_06010"); + roles.add("mst_11010"); + roles.add("ImisWorld"); + info.setRoles(roles); + List netz = new ArrayList(); + netz.add("06"); + netz.add("11"); + info.setNetzbetreiber(netz); + List mess = new ArrayList(); + mess.add("06010"); + mess.add("11010"); + info.setMessstellen(mess); + return info; + } + + @Override + public Response filter(Object source, Response data, Class clazz) { + return data; + } + + @Override + public boolean isAuthorized(Object source, Object data, + RequestMethod method, Class clazz) { + return true; + } + + @Override + public boolean isAuthorized(UserInfo userInfo, Object data) { + return true; + } + + @Override + public boolean isReadOnly(Integer probeId) { + return false; + } + +}