Skip to content

Commit

Permalink
fix(impl): [#199] group constants via interface
Browse files Browse the repository at this point in the history
reason: better distinguish between configured and registered default policy/policies
  • Loading branch information
dsmf committed Apr 9, 2024
1 parent b04026d commit 06c542a
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,20 @@
})
public class PolicyStoreService implements AcceptedPoliciesProvider {

public static final int DEFAULT_POLICY_LIFETIME_YEARS = 5;
/**
* Constants for the configured default policy.
*/
private interface ConfiguredDefaultPolicy {
/**
* ID for default policy (see TRI-1594)
*/
String DEFAULT_POLICY_ID = "default-policy";

/**
* Lifetime for default policy in years (see TRI-1594)
*/
int DEFAULT_POLICY_LIFETIME_YEARS = 5;
}

private final List<Policy> allowedPoliciesFromConfig;

Expand Down Expand Up @@ -295,6 +308,8 @@ private List<Policy> createDefaultPolicyFromConfig(
acceptedPolicy.getRightOperand())));
final Policy policy = new Policy("default-policy", OffsetDateTime.now(),
OffsetDateTime.now().plusYears(DEFAULT_POLICY_LIFETIME_YEARS),
final Policy policy = new Policy(ConfiguredDefaultPolicy.DEFAULT_POLICY_ID, OffsetDateTime.now(),
OffsetDateTime.now().plusYears(ConfiguredDefaultPolicy.DEFAULT_POLICY_LIFETIME_YEARS),
List.of(new Permission(PolicyType.USE, new Constraints(constraints, constraints))));

return List.of(policy);
Expand Down

0 comments on commit 06c542a

Please sign in to comment.