use of org.mycore.access.mcrimpl.MCRAccessRule in project mycore by MyCoRe-Org.
the class MCRAclEditorResource method list.
@GET
@MCRRestrictedAccess(MCRAclEditorPermission.class)
public String list() {
Collection<String> ruleIDs = RULE_STORE.retrieveAllIDs();
JsonArray jsonARules = new JsonArray();
JsonObject jsonObj = new JsonObject();
for (String id : ruleIDs) {
MCRAccessRule rule = RULE_STORE.getRule(id);
JsonObject jsonO = new JsonObject();
jsonO.addProperty("ruleID", id);
jsonO.addProperty("desc", rule.getDescription());
jsonO.addProperty("ruleSt", rule.getRuleString());
jsonARules.add(jsonO);
}
jsonObj.add("rules", jsonARules);
JsonArray jsonAAccess = new JsonArray();
Collection<String> ids = ACCESS_STORE.getDistinctStringIDs();
for (String id : ids) {
Collection<String> pools = ACCESS_STORE.getPoolsForObject(id);
for (String pool : pools) {
JsonObject jsonO = new JsonObject();
jsonO.addProperty("accessID", id);
jsonO.addProperty("accessPool", pool);
jsonO.addProperty("rule", ACCESS_STORE.getRuleID(id, pool));
jsonAAccess.add(jsonO);
}
}
jsonObj.add("access", jsonAAccess);
return jsonObj.toString();
}
Aggregations