Skip to content

Commit fd2f77f

Browse files
Feature/Allow succession if DeletionRequestRejected (#216)
* feat: allow succession of attribute with deletionStatus DeletionRequestRejected * chore: version bump * chore: version bump --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent e345029 commit fd2f77f

File tree

5 files changed

+36
-7
lines changed

5 files changed

+36
-7
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/consumption/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nmshd/consumption",
3-
"version": "3.12.3",
3+
"version": "3.12.4",
44
"description": "The consumption library extends the transport library.",
55
"homepage": "https://enmeshed.eu",
66
"repository": {

packages/consumption/src/modules/attributes/AttributesController.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { CreateLocalAttributeParams, ICreateLocalAttributeParams } from "./local
3737
import { ICreatePeerLocalAttributeParams } from "./local/CreatePeerLocalAttributeParams";
3838
import { CreateSharedLocalAttributeCopyParams, ICreateSharedLocalAttributeCopyParams } from "./local/CreateSharedLocalAttributeCopyParams";
3939
import { ILocalAttribute, LocalAttribute, LocalAttributeJSON } from "./local/LocalAttribute";
40+
import { DeletionStatus } from "./local/LocalAttributeDeletionInfo";
4041
import { LocalAttributeShareInfo } from "./local/LocalAttributeShareInfo";
4142
import { IdentityAttributeQueryTranslator, RelationshipAttributeQueryTranslator, ThirdPartyRelationshipAttributeQueryTranslator } from "./local/QueryTranslator";
4243

@@ -891,7 +892,7 @@ export class AttributesController extends ConsumptionBaseController {
891892
return ValidationResult.error(CoreErrors.attributes.successionMustNotChangeValueType());
892893
}
893894

894-
if (predecessor.hasDeletionInfo()) {
895+
if (predecessor.hasDeletionInfo() && predecessor.deletionInfo.deletionStatus !== DeletionStatus.DeletionRequestRejected) {
895896
return ValidationResult.error(CoreErrors.attributes.cannotSucceedAttributesWithDeletionInfo());
896897
}
897898

packages/consumption/test/modules/attributes/AttributesController.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,34 @@ describe("AttributesController", function () {
11121112
code: "error.consumption.attributes.cannotSucceedAttributesWithDeletionInfo"
11131113
});
11141114
});
1115+
1116+
test("should allow succession if the predecessor has a deletionInfo with status DeletionRequestRejected", async function () {
1117+
const predecessor = await consumptionController.attributes.createAttributeUnsafe({
1118+
content: IdentityAttribute.from({
1119+
value: {
1120+
"@type": "Nationality",
1121+
value: "DE"
1122+
},
1123+
owner: CoreAddress.from("address")
1124+
}),
1125+
deletionInfo: LocalAttributeDeletionInfo.from({
1126+
deletionStatus: DeletionStatus.DeletionRequestRejected,
1127+
deletionDate: CoreDate.utc().subtract({ days: 1 })
1128+
})
1129+
});
1130+
const successorData: IAttributeSuccessorParams = {
1131+
content: IdentityAttribute.from({
1132+
value: {
1133+
"@type": "Nationality",
1134+
value: "DE"
1135+
},
1136+
owner: CoreAddress.from("address")
1137+
})
1138+
};
1139+
1140+
const validationResult = await consumptionController.attributes.validateAttributeSuccessionCommon(predecessor.id, successorData);
1141+
expect(validationResult.isSuccess()).toBe(true);
1142+
});
11151143
});
11161144

11171145
describe("Validator for own shared identity attribute successions", function () {

packages/runtime/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nmshd/runtime",
3-
"version": "4.14.3",
3+
"version": "4.14.4",
44
"description": "The enmeshed client runtime.",
55
"homepage": "https://enmeshed.eu",
66
"repository": {
@@ -56,7 +56,7 @@
5656
"@js-soft/logging-abstractions": "^1.0.1",
5757
"@js-soft/ts-serval": "2.0.10",
5858
"@js-soft/ts-utils": "^2.3.3",
59-
"@nmshd/consumption": "3.12.3",
59+
"@nmshd/consumption": "3.12.4",
6060
"@nmshd/content": "2.11.0",
6161
"@nmshd/crypto": "2.0.6",
6262
"@nmshd/transport": "2.8.2",

0 commit comments

Comments
 (0)