Commit 2366cd98 by Antti Tönkyrä

Tournament admin functionality to deletes, no UI yet

1 parent 0699436d
...@@ -234,14 +234,14 @@ public class TournamentBean implements TournamentBeanLocal { ...@@ -234,14 +234,14 @@ public class TournamentBean implements TournamentBeanLocal {
EventUser executor = permissionBean.getCurrentUser(); EventUser executor = permissionBean.getCurrentUser();
// Assert we have permission to remove participant // Assert we have permission to remove participant
// TODO: this will include check for remove any participation too! if(permissionBean.hasPermission(TournamentPermission.REMOVE_OWN_PARTICIPATION) && tp.getParticipator().equals(executor)) {
if (!permissionBean.hasPermission(TournamentPermission.REMOVE_OWN_PARTICIPATION) || !tp.getParticipator().equals(executor)) {
throw new Exception("tournaments.can_only_remove_own_participations"); throw new Exception("tournaments.can_only_remove_own_participations");
} else if(!tp.getParticipator().equals(executor) && permissionBean.hasPermission(TournamentPermission.MANAGE_ALL)) {
throw new Exception("tournaments.cannot_remove_others_participations");
} }
// Assert that tournament has not closed participation // Assert that tournament has not closed participation
// TODO: admin exception! if (!permissionBean.hasPermission(TournamentPermission.MANAGE_ALL) && !tp.getTournament().getRegistrationClosesAt().after(new Date())) {
if (!tp.getTournament().getRegistrationClosesAt().after(new Date())) {
throw new Exception("tournaments.cannot_remove_participation_from_closed_tournament"); throw new Exception("tournaments.cannot_remove_participation_from_closed_tournament");
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!