All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.payneteasy.superfly.security.mapbuilder.AllForAllActionsMapBuilder Maven / Gradle / Ivy

package com.payneteasy.superfly.security.mapbuilder;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Required;

import com.payneteasy.superfly.api.SSOAction;
import com.payneteasy.superfly.api.SSORole;

/**
 * {@link ActionsMapBuilder} which gives every role the same actions.
 * 
 * @author Roman Puchkovskiy
 */
public class AllForAllActionsMapBuilder implements ActionsMapBuilder {

    private List roleNames = new ArrayList();
    private ActionsSource actionsSource;

    public void setRoleNames(List roleNames) {
        this.roleNames = roleNames;
    }

    @Required
    public void setActionsSource(ActionsSource actionsSource) {
        this.actionsSource = actionsSource;
    }

    public Map build() throws Exception {
        Map map = new HashMap();
        for (String roleName : roleNames) {
            SSORole role = new SSORole(roleName);
            SSOAction[] actions = actionsSource.getActions();
            map.put(role, actions);
        }
        return map;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy