刘光辉
5 小时以前 06f314545ac3514d7ce28939920866ae8188d31c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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<String> 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);
    }
}