You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Affects all connectors that are using the PostgreSQL Policy Extension.
When there is any contract definition defined, it is impossible to delete policies.
Expected Behavior
deletion of policies possible as long as its legal (not part of any definition etc.)
Observed Behavior
deletion of all policies impossible when contract definition exists
Steps to Reproduce
Steps to reproduce the behavior:
Create a Contract Definition
Create a new Policy
Delete the new Policy -> It's not possible to delete this new Policy
Context Information
Before deleting the Policy the PolicyService will check, whether a negotation exists for this asset. The SELECT does not filter.
@Overridepublic@NotNullServiceResult<Policy> deleteById(StringpolicyId) {
varcontractFilter = format("contractPolicyId = %s ", policyId);
varaccessFilter = format("accessPolicyId = %s ", policyId);
returntransactionContext.execute(() -> {
if (policyStore.findById(policyId) == null) {
returnServiceResult.notFound(format("Policy %s does not exist", policyId));
}
varqueryContractPolicyFilter = QuerySpec.Builder.newInstance().filter(contractFilter).build();
varcontractDefinitionOnPolicy = contractDefinitionStore.findAll(queryContractPolicyFilter);
if (contractDefinitionOnPolicy.findAny().isPresent()) {
returnServiceResult.conflict(format("Policy %s cannot be deleted as it is referenced by at least one contract policy", policyId));
}
// more codereturnServiceResult.success(deleted);
});
}
Dynamic filtering is NOT supported yet on the SQL implementations. In order to enable dynamically composing WHERE/AND statements in a safe way (avoiding SQL injection) we could re-use the CosmosDB implementation. That's another PR though.
I suggest adding a method isReferenced(String policyId) that checks whether a particular policy is referenced as either contract- or accesspolicy on any definition.
Bug Report
Describe the Bug
Affects all connectors that are using the PostgreSQL Policy Extension.
When there is any contract definition defined, it is impossible to delete policies.
Expected Behavior
Observed Behavior
Steps to Reproduce
Steps to reproduce the behavior:
Context Information
Before deleting the Policy the PolicyService will check, whether a negotation exists for this asset. The SELECT does not filter.
Detailed Description
Possible Implementation
Dominik Pinsel [email protected], Mercedes-Benz Tech Innovation GmbH, legal info/Impressum
The text was updated successfully, but these errors were encountered: