use of com.bakdata.conquery.models.auth.permissions.StringPermissionBuilder in project conquery by bakdata.
the class UIProcessor method preparePermissionTemplate.
private Map<String, Pair<Set<Ability>, List<Object>>> preparePermissionTemplate() {
Map<String, Pair<Set<Ability>, List<Object>>> permissionTemplateMap = new HashMap<>();
// Grab all possible permission types for the "Create Permission" section
Set<Class<? extends StringPermissionBuilder>> permissionTypes = CPSTypeIdResolver.listImplementations(StringPermissionBuilder.class);
for (Class<? extends StringPermissionBuilder> permissionType : permissionTypes) {
try {
StringPermissionBuilder instance = (StringPermissionBuilder) permissionType.getField("INSTANCE").get(null);
// Right argument is for possible targets of a specific permission type, but it
// is left empty for now.
permissionTemplateMap.put(instance.getDomain(), Pair.of(instance.getAllowedAbilities(), List.of()));
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
log.error("Could not access allowed abilities for permission type: {}", permissionType, e);
}
}
return permissionTemplateMap;
}
Aggregations