Improve WithUser testing (#2943)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2026-02-27 12:59:13 +02:00
committed by GitHub
parent f2318078bd
commit 5d043b2766
19 changed files with 161 additions and 203 deletions

View File

@@ -10,6 +10,7 @@
package org.eclipse.hawkbit.auth;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.springframework.security.access.hierarchicalroles.RoleHierarchy;
@@ -25,12 +26,9 @@ public class Hierarchy {
SpRole.DEFAULT_ROLE_HIERARCHY;
// @formatter:on
@Getter
private static RoleHierarchy roleHierarchy;
public static RoleHierarchy getRoleHierarchy() {
return roleHierarchy;
}
public static void setRoleHierarchy(final RoleHierarchy roleHierarchy) {
Hierarchy.roleHierarchy = roleHierarchy;
}

View File

@@ -27,10 +27,9 @@ import org.springframework.util.function.SingletonSupplier;
/**
* <p>
* Software provisioning permissions that are technically available as {@linkplain GrantedAuthority} based on
* Tenant software provisioning permissions that are technically available as {@linkplain GrantedAuthority} based on
* the authenticated users identity context.
* </p>
*
* <p>
* The permissions cover CRUD operations for various areas within eclipse hawkBit, like targets, software-artifacts,
* distribution sets, config-options etc.
@@ -127,7 +126,7 @@ public final class SpPermission {
TENANT_CONFIGURATION + IMPLY + READ_GATEWAY_SECURITY_TOKEN + LINE_BREAK;
// @formatter:on
private static final SingletonSupplier<Set<String>> ALL_TENANT_AUTHORITIES = SingletonSupplier.of(SpPermission::getAuthorities);
private static final SingletonSupplier<Set<String>> ALL_AUTHORITIES = SingletonSupplier.of(SpPermission::getAuthorities);
private static Set<String> getAuthorities() {
final Set<String> allPermissions = new HashSet<>();
@@ -155,7 +154,7 @@ public final class SpPermission {
}
public static Set<String> getAllAuthorities() {
return ALL_TENANT_AUTHORITIES.get();
return ALL_AUTHORITIES.get();
}
@SuppressWarnings("java:S3776") // java:S3776 - better in one place for better readability