Package org.geoserver.security.web.role

Source Code of org.geoserver.security.web.role.RoleServiceConfigListModel

/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
*/
package org.geoserver.security.web.role;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.model.LoadableDetachableModel;
import org.geoserver.security.GeoServerSecurityManager;
import org.geoserver.security.config.SecurityRoleServiceConfig;
import org.geoserver.web.GeoServerApplication;

/**
* Model for list of role services configurations.
*
* @author Justin Deoliveira, OpenGeo
*/
public class RoleServiceConfigListModel
    extends LoadableDetachableModel<List<SecurityRoleServiceConfig>> {

    @Override
    protected List<SecurityRoleServiceConfig> load() {
        GeoServerSecurityManager secMgr = GeoServerApplication.get().getSecurityManager();
        List<SecurityRoleServiceConfig> configs = new ArrayList();
        try {
            for (String roleServiceName : secMgr.listRoleServices()) {
                SecurityRoleServiceConfig config = secMgr.loadRoleServiceConfig(roleServiceName);
                configs.add(config);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return configs;
    }
}
TOP

Related Classes of org.geoserver.security.web.role.RoleServiceConfigListModel

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.