Skip to content

Commit

Permalink
fix(registrar): transaction for approving multiple applications
Browse files Browse the repository at this point in the history
- Approval or rejection of multiple applications can't run in a single
  transaction since it is subject to non-revertible effects (like
  sending emails).
- We can't afford to rollback action on X applications just because
  one of them failed.
- GUI should be probably updated to handle this change and maybe
  also server can provide better feedback.
  • Loading branch information
zlamalp committed Nov 7, 2023
1 parent c6c1850 commit 85c1050
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1745,11 +1745,10 @@ public Application rejectApplication(PerunSession sess, int appId, String reason
}

@Override
@Transactional(rollbackFor = Exception.class)
public void rejectApplications(PerunSession sess, List<Integer> applicationIds, String reason) throws PerunException {
Collections.sort(applicationIds, Collections.reverseOrder());
for (Integer id : applicationIds) {
rejectApplication(sess, id, reason);
registrarManager.rejectApplication(sess, id, reason);
}
}

Expand Down Expand Up @@ -1851,7 +1850,6 @@ public Application approveApplication(PerunSession sess, int appId) throws Perun
}

@Override
@Transactional(rollbackFor = Exception.class)
public void approveApplications(PerunSession sess, List<Integer> applicationIds) throws PerunException {
Collections.sort(applicationIds);
for (Integer id : applicationIds) {
Expand Down

0 comments on commit 85c1050

Please sign in to comment.