@EventSourcingHandler public void handle(ChargingStationCreatedEvent event) { this.id = event.getChargingStationId(); for(UserIdentity identity : event.getUserIdentitiesWithAllPermissions()) { this.authorizations.put(identity, AllPermissions.class); } }
/** * Handles {@code ChargingStationCreatedEvent} which contains the initial authorizations. Initial authorizations * are updated in the command authorization repository. * * @param event contains information about command authorization. */ @EventHandler public void handle(ChargingStationCreatedEvent event) { for (UserIdentity userIdentity : event.getUserIdentitiesWithAllPermissions()) { commandAuthorizationRepository.createOrUpdate(event.getChargingStationId().getId(), userIdentity.getId(), AllPermissions.class); } }