diff --git a/backend/src/main/java/com/bakdata/conquery/models/config/auth/DefaultAuthorizationConfig.java b/backend/src/main/java/com/bakdata/conquery/models/config/auth/DefaultAuthorizationConfig.java index 299b402789..0ba2a1f284 100644 --- a/backend/src/main/java/com/bakdata/conquery/models/config/auth/DefaultAuthorizationConfig.java +++ b/backend/src/main/java/com/bakdata/conquery/models/config/auth/DefaultAuthorizationConfig.java @@ -1,5 +1,6 @@ package com.bakdata.conquery.models.config.auth; +import java.util.Collections; import java.util.List; import java.util.Set; @@ -7,12 +8,15 @@ import com.bakdata.conquery.apiv1.auth.ProtoUser; import com.bakdata.conquery.io.cps.CPSType; import com.bakdata.conquery.models.auth.permissions.AdminPermission; +import com.bakdata.conquery.models.auth.permissions.DatasetPermission; +import com.bakdata.conquery.models.auth.permissions.SuperPermission; +import io.dropwizard.validation.ValidationMethod; import jakarta.validation.Valid; import jakarta.validation.constraints.NotEmpty; -import lombok.Getter; +import lombok.Data; @CPSType(base = AuthorizationConfig.class, id = "DEFAULT") -@Getter +@Data public class DefaultAuthorizationConfig implements AuthorizationConfig { @Valid @@ -21,10 +25,14 @@ public class DefaultAuthorizationConfig implements AuthorizationConfig { .permissions(Set.of(AdminPermission.DOMAIN)) .build()); - @NotEmpty @Valid - private List initialUsers; + private List initialUsers = Collections.emptyList(); @NotEmpty - private List overviewScope; + private List overviewScope = List.of(DatasetPermission.DOMAIN, AdminPermission.DOMAIN, SuperPermission.DOMAIN); + + @ValidationMethod(message = "No initial entities defined. Access will not be possible") + public boolean isInitialAccessPossible() { + return !(initialRoles.isEmpty() && initialUsers.isEmpty()); + } }