Commit e37f3357 authored by Noel Alonso's avatar Noel Alonso
Browse files

Añade comprobación de usuario en eventos

Para los casos en los que se necesita garantizar que eventos históricos
sean del mismo usuario que el nuevo evento.
parent 493fdca4
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import es.redmic.brokerlib.avro.common.EventTypes;
import es.redmic.commandslib.exceptions.HistoryNotFoundException;
import es.redmic.commandslib.exceptions.ItemLockedException;
import es.redmic.exception.data.ItemNotFoundException;
import es.redmic.exception.settings.SettingsChangeForbiddenException;

public abstract class Aggregate {

@@ -157,4 +158,10 @@ public abstract class Aggregate {
	public boolean isDeleted() {
		return deleted;
	}

	protected void authorshipCheck(String userId, String historicalEventUserId) {

		if (historicalEventUserId != null && !userId.equals(historicalEventUserId))
			throw new SettingsChangeForbiddenException();
	}
}