Improve Permission Management (#2604)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -12,7 +12,7 @@ package org.eclipse.hawkbit.repository.test.util;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpPermission.READ_TENANT_CONFIGURATION;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpRole.SYSTEM_ROLE;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpringEvalExpressions.CONTROLLER_ROLE;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpRole.CONTROLLER_ROLE;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -45,10 +45,10 @@ public class SecurityContextSwitch {
|
||||
public static <T> T callAs(final WithUser withUser, final Callable<T> callable) throws Exception {
|
||||
final SecurityContext oldContext = SecurityContextHolder.getContext();
|
||||
setSecurityContext(withUser);
|
||||
if (withUser.autoCreateTenant()) {
|
||||
createTenant(withUser.tenantId());
|
||||
}
|
||||
try {
|
||||
if (withUser.autoCreateTenant()) {
|
||||
createTenant(withUser.tenantId());
|
||||
}
|
||||
return callable.call();
|
||||
} finally {
|
||||
SecurityContextHolder.setContext(oldContext);
|
||||
|
||||
Reference in New Issue
Block a user