diff --git a/core/src/main/java/de/bstly/we/businesslogic/PermissionManager.java b/core/src/main/java/de/bstly/we/businesslogic/PermissionManager.java index cb64d79..cab547d 100755 --- a/core/src/main/java/de/bstly/we/businesslogic/PermissionManager.java +++ b/core/src/main/java/de/bstly/we/businesslogic/PermissionManager.java @@ -420,12 +420,11 @@ public class PermissionManager implements UserDataProvider { List existingPermissions = get(target, name); for (Permission existingPermission : existingPermissions) { - if (additional && existingPermission.getExpires().isAfter(Instant.now()) - && (starts == null && (existingPermission.getStarts() == null - || existingPermission.getStarts().isBefore(Instant.now())) - || starts != null && (starts.isBefore(existingPermission.getExpires()) - || existingPermission.getStarts() != null - && starts.isAfter(existingPermission.getStarts())))) { + if (additional && (starts == null && (existingPermission.getStarts() == null + || existingPermission.getStarts().isBefore(Instant.now())) + || starts != null && (starts.isBefore(existingPermission.getExpires()) + || existingPermission.getStarts() != null + && starts.isAfter(existingPermission.getStarts())))) { if (permission == null) { permission = existingPermission; } else if (existingPermission.getExpires().isAfter(permission.getExpires())) { @@ -441,8 +440,6 @@ public class PermissionManager implements UserDataProvider { permission.setAddon(permissionMapping.isAddon()); permission.setStarts(permissionStarts); permission.setExpires(permissionsExpires); - logger.debug("now: " + Instant.now() + "\nstart: " + permissionStarts + "\nexpires here: " - + permission.getExpires()); } else { if (permission.getExpires() == null || permission.getExpires().isBefore(Instant.now())) { permission.setExpires(Instant.now()); @@ -460,10 +457,6 @@ public class PermissionManager implements UserDataProvider { permission.setExpires( InstantHelper.truncate(permission.getExpires(), permissionMapping.getLifetimeUnit())); } - - logger.debug("Permission: \n" + permission.getName() + "\n" + permission.getId() + "\n" - + permission.getTarget() + "\n" + permission.getStarts() + "\n" + permission.getExpires()); - permissions.add(permission); } }