view src/main/java/de/intevation/lada/util/auth/TestAuthorization.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 5815920ccabc
children fa922101a462 1ed347eb856b
line wrap: on
line source
/* 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.NONE)
public class TestAuthorization implements Authorization {

    @Override
    public UserInfo getInfo(Object source) {
        UserInfo info = new UserInfo();
        info.setName("testeins");
        List<String> roles = new ArrayList<String>();
        roles.add("mst_06010");
        roles.add("mst_11010");
        roles.add("ImisWorld");
        info.setRoles(roles);
        List<String> netz = new ArrayList<String>();
        netz.add("06");
        netz.add("11");
        info.setNetzbetreiber(netz);
        List<String> mess = new ArrayList<String>();
        mess.add("06010");
        mess.add("11010");
        info.setMessstellen(mess);
        return info;
    }

    @Override
    public <T> Response filter(Object source, Response data, Class<T> clazz) {
        return data;
    }

    @Override
    public <T> boolean isAuthorized(Object source, Object data,
            RequestMethod method, Class<T> clazz) {
        return true;
    }

    @Override
    public boolean isAuthorized(UserInfo userInfo, Object data) {
        return true;
    }

    @Override
    public boolean isReadOnly(Integer probeId) {
        return false;
    }

    @Override
    public <T> boolean isAuthorized(int id, Class<T> clazz) {
        return true;
    }

}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)