return update;
}
@Override
public void purgePluginConfigurationUpdate(Subject subject, int configurationUpdateId, boolean purgeInProgress) {
PluginConfigurationUpdate doomedRequest = entityManager.find(PluginConfigurationUpdate.class,
configurationUpdateId);
if (doomedRequest == null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Asked to purge a non-existing config update request [" + configurationUpdateId + "]");
}
return;
}
if ((doomedRequest.getStatus() == ConfigurationUpdateStatus.INPROGRESS) && !purgeInProgress) {
throw new IllegalStateException(
"The update request is still in the in-progress state. Please wait for it to complete: "
+ doomedRequest);
}
// make sure the user has the proper permissions to do this
Resource resource = doomedRequest.getResource();
if (!authorizationManager.hasResourcePermission(subject, Permission.MODIFY_RESOURCE, resource.getId())) {
throw new PermissionException("User [" + subject.getName()
+ "] does not have permission to purge a plugin configuration update audit trail for resource ["
+ resource + "]");
}