use of alien4cloud.audit.model.AuditConfiguration in project alien4cloud by alien4cloud.
the class AuditController method enableAudit.
@ApiOperation(value = "Enable/Disable audit", notes = "Audit configuration update is only accessible to user with role [ ADMIN ]")
@RequestMapping(value = "/configuration/enabled", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasAuthority('ADMIN')")
public RestResponse<Void> enableAudit(@RequestParam boolean enabled) {
AuditConfiguration auditConfiguration = auditService.getMandatoryAuditConfiguration();
auditConfiguration.setEnabled(enabled);
auditService.saveAuditConfiguration(auditConfiguration);
return RestResponseBuilder.<Void>builder().build();
}
use of alien4cloud.audit.model.AuditConfiguration in project alien4cloud by alien4cloud.
the class AuditController method register.
/**
* Register a dynamic RequestMappingHandlerMapping in the audit management system.
*
* @param requestMappingHandlerMapping The dynamic RequestMappingHandlerMapping to handle for audit.
*/
public void register(RequestMappingHandlerMapping requestMappingHandlerMapping) {
registeredRequestMappingHandlerMapping.add(requestMappingHandlerMapping);
// update configuration to inclure methods from plugin or context
Map<Method, Boolean> allAvailableMethodsForAudit = getAllAvailableMethodsForAudit(requestMappingHandlerMapping);
AuditConfiguration configuration = auditService.getAuditConfiguration();
// Put all in new map to not override existing user settings if some methods are already defined.
allAvailableMethodsForAudit.putAll(configuration.getAuditedMethodsMap());
configuration.setAuditedMethodsMap(allAvailableMethodsForAudit);
auditService.saveAuditConfiguration(configuration);
}
Aggregations