package jnpf.flowable.service.dev; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; import java.util.HashSet; import java.util.Set; /** Explicit server-side opt-in; no frontend flag can enable this feature. */ @Data @Component @ConfigurationProperties(prefix = "workflow.dev-approval") public class DevApprovalProperties { @org.springframework.beans.factory.annotation.Autowired private org.springframework.core.env.Environment runtime; private boolean enabled; private String environment = "production"; private Set formIds = new HashSet<>(); public boolean available() { return enabled && "development".equals(environment) && runtime != null && runtime.acceptsProfiles(org.springframework.core.env.Profiles.of("workflow-dev-tools & !prod & !production")); } /** An empty allowlist enables all forms; a configured list narrows the scope. */ public boolean allowsForm(String formId) { return formIds.isEmpty() || formIds.contains(formId); } }