use of com.thoughtworks.go.config.policy.SupportedEntity.ELASTIC_AGENT_PROFILE in project gocd by gocd.
the class ElasticAgentProfilePermission method permissions.
@Override
public Map<String, Object> permissions(Username username) {
SupportedEntity entityType = ELASTIC_AGENT_PROFILE;
List<ElasticProfile> elasticProfiles = config().getElasticConfig().getProfiles();
LinkedHashMap<String, Object> json = new LinkedHashMap<>();
json.put(VIEW.getAction(), elasticProfiles.stream().filter(profile -> canView(entityType, profile.getId(), profile.getClusterProfileId())).map(ElasticProfile::getId).collect(Collectors.toList()));
json.put(ADMINISTER.getAction(), elasticProfiles.stream().filter(profile -> canAdminister(entityType, profile.getId(), profile.getClusterProfileId())).map(ElasticProfile::getId).collect(Collectors.toList()));
return json;
}
Aggregations