Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions server/src/main/java/invite/api/SystemController.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,22 @@ public SystemController(ResourceCleaner resourceCleaner,

@GetMapping("/cron/cleanup")
public ResponseEntity<Map<String, List<? extends Serializable>>> cronCleanup(@Parameter(hidden = true) User user) {
LOG.debug("/cron/cleanup");
LOG.debug(String.format("/cron/cleanup for user %s", user.getEduPersonPrincipalName()));
UserPermissions.assertSuperUser(user);
Map<String, List<? extends Serializable>> body = resourceCleaner.doClean();
return ResponseEntity.ok(body);
}

@GetMapping("/cron/expiry-notifications")
public ResponseEntity<Map<String, List<String>>> expiryNotifications(@Parameter(hidden = true) User user) {
LOG.debug("/cron/expiry-notifications");
LOG.debug(String.format("/cron/expiry-notifications for user %s", user.getEduPersonPrincipalName()));
UserPermissions.assertSuperUser(user);
return ResponseEntity.ok(Map.of("mails", roleExpirationNotifier.doSweep()));
}

@GetMapping("/expiry-user-roles")
public ResponseEntity<List<UserRole>> expiryUserRoles(@Parameter(hidden = true) User user) {
LOG.debug("/cron/notifications");
LOG.debug(String.format("/expiry-user-roles for user %s", user.getEduPersonPrincipalName()));
UserPermissions.assertSuperUser(user);
Instant instant = Instant.now().plus(30, ChronoUnit.DAYS);
List<UserRole> userRoles = userRoleRepository.findByEndDateBefore(instant);
Expand All @@ -91,8 +91,7 @@ public ResponseEntity<List<UserRole>> expiryUserRoles(@Parameter(hidden = true)
@GetMapping("/unknown-roles")
@Transactional(readOnly = true)
public ResponseEntity<List<Role>> unknownRoles(@Parameter(hidden = true) User user) {
LOG.debug("/unknown-roles");

LOG.debug(String.format("/unknown-roles for user %s", user.getEduPersonPrincipalName()));
UserPermissions.assertSuperUser(user);
List<Role> roles = manage.addManageMetaData(roleRepository.findAll());
List<Role> unknownManageRoles = roles.stream().filter(role -> role.getApplicationMaps().stream().anyMatch(applicationMap -> applicationMap.containsKey("unknown"))).toList();
Expand All @@ -104,6 +103,7 @@ public ResponseEntity<Map<String, Object>> performanceSeed(@Parameter(hidden = t
@RequestParam(value = "numberOfRole", required = false, defaultValue = "500") int numberOfRole,
@RequestParam(value = "numberOfUsers", required = false, defaultValue = "75000") int numberOfUsers) {
LOG.debug("/performance-seed");
LOG.debug(String.format("/performance-seed for user %s", user.getEduPersonPrincipalName()));
if (!config.isPerformanceSeedAllowed()) {
throw new NotAllowedException("performance-seed not allowed");
}
Expand Down
Loading