remove tracked races and ownerships/acls when a regatta is removed

This commit is contained in:
Kai Börnert committed 2018-12-07 14:24:42 +01:00
1 parent 3109918967
commit ab3b12872c
1 file changed
+19
@@ -4637,6 +4637,25 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
getSecurityService().checkPermissionAndDeleteOwnershipForObjectRemoval(regatta, new Action() {
@Override
public void run() throws Exception {
// if there were any tracked races, free all ownerships
for (RaceDefinition race : regatta.getAllRaces()) {
String typeRelativeObjectIdentifier = WildcardPermissionEncoder.encode(regatta.getName(),
race.getName());
QualifiedObjectIdentifier identifier = SecuredDomainType.TRACKED_RACE
.getQualifiedObjectIdentifier(typeRelativeObjectIdentifier);
getSecurityService().checkPermissionAndDeleteOwnershipForObjectRemoval(identifier,
new ActionWithResult<Void>() {
@Override
public Void run() throws Exception {
RegattaNameAndRaceName raceIdentifier = new RegattaNameAndRaceName(
regatta.getName(), race.getName());
ArrayList<RegattaAndRaceIdentifier> trackedRace = new ArrayList<>();
trackedRace.add(raceIdentifier);
removeAndUntrackRaces(trackedRace);
return null;
}
});
}
getService().apply(new RemoveRegatta(regattaIdentifier));
}
});