if( atlasInfo.isRestricted() ){
roles.add(atlasInfo.getAtlasName() + "_user");
}
CouchDb atlasDb = couchClient.getDatabase(atlasInfo.getDatabaseName());
CouchDesignDocument atlasDesign = atlasDb.getDesignDocument("atlas");
// Roles from layer definitions
{
CouchQuery query = new CouchQuery();
query.setViewName("layer-definitions");
CouchQueryResults queryResults = atlasDesign.performQuery(query);
for(JSONObject row : queryResults.getRows()){
String layerId = row.getString("key");
if( false == "public".equals(layerId) ) {
String layerRole = atlasInfo.getAtlasName() + "_layer_" + layerId;
roles.add(layerRole);
}
}
}
// Roles from layers in use
{
CouchQuery query = new CouchQuery();
query.setViewName("layers");
query.setReduce(true);
query.setGrouping(true);
CouchQueryResults queryResults = atlasDesign.performQuery(query);
for(JSONObject row : queryResults.getRows()){
String layerId = row.getString("key");
if( false == "public".equals(layerId) ) {
String layerRole = atlasInfo.getAtlasName() + "_layer_" + layerId;
roles.add(layerRole);