Skip to content

Commit

Permalink
Merge pull request #73 from virtualidentityag/feat/VIC-2319_validatio…
Browse files Browse the repository at this point in the history
…n_endpoint

VIC-2319: added case for single domain multitenancy
  • Loading branch information
adnanalicic authored Feb 13, 2023
2 parents 18dd56c + eee43bb commit 891e8c2
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.stereotype.Service;

Expand All @@ -33,6 +34,9 @@ public class TenantFacadeAuthorisationService {

private final @NonNull ApplicationSettingsService applicationSettingsService;

@Value("${feature.multitenancy.with.single.domain.enabled}")
private boolean multitenancyWithSingleDomain;

private boolean userHasAnyRoleOf(List<UserRole> roles) {
return roles.stream().anyMatch(userRole -> authorisationService.hasRole(userRole.getValue()));
}
Expand Down Expand Up @@ -176,9 +180,10 @@ private void logAndThrowTenantAuthorisationException(
}

public boolean canAccessTenant(Optional<TenantEntity> tenant) {
if (isSuperAdmin()) {
if (isSuperAdmin() || multitenancyWithSingleDomain) {
return true;
}

if (tenant.isEmpty()) {
return false;
}
Expand Down

0 comments on commit 891e8c2

Please sign in to comment.