allow admins to bypass cloud env checks
All checks were successful
Deploy API / deploy (ubuntu-latest, 2.44.0) (push) Successful in 50s

This commit is contained in:
Braydon 2024-09-20 08:15:01 -04:00
parent 58b7b69bb3
commit 3d16aa73ea
2 changed files with 3 additions and 2 deletions

@ -7,6 +7,7 @@ import cc.pulseapp.api.model.IGenericResponse;
import cc.pulseapp.api.model.org.DetailedOrganization;
import cc.pulseapp.api.model.org.Organization;
import cc.pulseapp.api.model.user.User;
import cc.pulseapp.api.model.user.UserFlag;
import cc.pulseapp.api.repository.OrganizationRepository;
import cc.pulseapp.api.repository.StatusPageRepository;
import jakarta.annotation.Nonnull;
@ -72,7 +73,7 @@ public final class OrganizationService {
throw new BadRequestException(Error.ORG_SLUG_TAKEN);
}
// Handle cloud environment checks
if (EnvironmentUtils.isCloud()) {
if (EnvironmentUtils.isCloud() && !owner.hasFlag(UserFlag.ADMINISTRATOR)) {
if (orgRepository.findByOwnerSnowflake(owner.getSnowflake()).size() >= owner.getTier().getMaxOrganizations()) {
throw new BadRequestException(Error.MAX_ORGS_REACHED);
}

@ -55,7 +55,7 @@ public final class StatusPageService {
throw new BadRequestException(Error.STATUS_PAGE_NAME_TAKEN);
}
// Handle cloud environment checks
if (EnvironmentUtils.isCloud()) {
if (EnvironmentUtils.isCloud()/* && !owner.hasFlag(UserFlag.ADMINISTRATOR)*/) {
// TODO: do UserTier#maxStatusPages check
}
// Create the status page and return it