Remove SYSTEM_ADMIN (#2936)
Not needed. Overlaping with system role. Could be added on top of others if needed Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -29,14 +29,12 @@ import org.eclipse.hawkbit.repository.qfields.TargetTagFields;
|
||||
// utility class to validate authorities when ACM is enabled
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public final class AuthorityChecker {
|
||||
;
|
||||
|
||||
private static final Set<String> ALL_AUTHORITIES = SpPermission.getAllTenantAuthorities();
|
||||
|
||||
public static String[] validateAuthorities(final String... authorities) {
|
||||
public static void validateAuthorities(final String... authorities) {
|
||||
for (final String authority : authorities) {
|
||||
validateAuthority(authority);
|
||||
}
|
||||
return authorities;
|
||||
}
|
||||
|
||||
public static void validateAuthority(final String authority) {
|
||||
@@ -45,7 +43,7 @@ public final class AuthorityChecker {
|
||||
if (index > 0) {
|
||||
validateScope(group(unscopedPermission), authority.substring(index + 1), authority);
|
||||
}
|
||||
if (!ALL_AUTHORITIES.contains(unscopedPermission)) {
|
||||
if (!SpPermission.getAllAuthorities().contains(unscopedPermission)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Unknown permission: " + unscopedPermission + (index > 0 ? " (unscoped of " + authority + ")" : ""));
|
||||
}
|
||||
|
||||
@@ -86,30 +86,13 @@ class MultiTenancyEntityTest extends AbstractJpaIntegrationTest {
|
||||
assertThat(findTargetsForTenant).hasSize(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that tenant with proper permissions can read and delete other tenants.
|
||||
*/
|
||||
@Test
|
||||
@WithUser(tenantId = "mytenant", allSpPermissions = true)
|
||||
void deleteAnotherTenantPossible() throws Exception {
|
||||
// create target for another tenant
|
||||
final String anotherTenant = "anotherTenant";
|
||||
final String controllerAnotherTenant = "anotherController";
|
||||
createTargetForTenant(controllerAnotherTenant, anotherTenant);
|
||||
|
||||
assertThat(listTenants()).as("Expected number if tenants before deletion is").hasSize(3);
|
||||
systemManagement.deleteTenant(anotherTenant);
|
||||
assertThat(listTenants()).as("Expected number if tenants after deletion is").hasSize(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that tenant metadata is retrieved for the current tenant.
|
||||
*/
|
||||
@Test
|
||||
@WithUser(tenantId = "mytenant", autoCreateTenant = false, allSpPermissions = true)
|
||||
void getTenantMetdata() throws Exception {
|
||||
// logged in tenant mytenant - check if tenant default data is
|
||||
// autogenerated
|
||||
// logged in tenant mytenant - check if tenant default data is autogenerated
|
||||
assertThat(distributionSetTypeManagement.findAll(PAGE)).isEmpty();
|
||||
SecurityContextSwitch.asPrivileged(() ->
|
||||
assertThat(systemManagement.createTenantMetadata("mytenant").getTenant().toUpperCase()).isEqualTo("mytenant".toUpperCase()));
|
||||
|
||||
Reference in New Issue
Block a user