Skip to content

Commit

Permalink
Hotfix/2.2.2 (#1088)
Browse files Browse the repository at this point in the history
* #1055 Update block permissions

* update version

Co-authored-by: Stepan Kiryakov <[email protected]>
  • Loading branch information
Stepan-Kirjakov and Stepan-Kirjakov authored Jul 12, 2022
1 parent 540ba0f commit 0865752
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 63 deletions.
2 changes: 1 addition & 1 deletion api-docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "api-docs",
"version": "2.2.1",
"version": "2.2.2",
"description": "Swagger Documentation",
"main": "dist/index.js",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions api-gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
},
"author": "Envision Blockchain Solutions <[email protected]>",
"dependencies": {
"@guardian/common": "^2.2.1",
"@guardian/interfaces": "^2.2.1",
"@guardian/common": "^2.2.2",
"@guardian/interfaces": "^2.2.2",
"dotenv": "^16.0.0",
"express": "^4.17.1",
"jszip": "^3.7.1",
Expand Down Expand Up @@ -49,5 +49,5 @@
"start": "node dist/index.js",
"test": "mocha tests/**/*.test.js --reporter mocha-junit-reporter --reporter-options mochaFile=../test_results/ui-service.xml"
},
"version": "2.2.1"
"version": "2.2.2"
}
6 changes: 3 additions & 3 deletions auth-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
},
"author": "Envision Blockchain Solutions <[email protected]>",
"dependencies": {
"@guardian/common": "^2.2.1",
"@guardian/interfaces": "^2.2.1",
"@guardian/common": "^2.2.2",
"@guardian/interfaces": "^2.2.2",
"dotenv": "^16.0.0",
"jsonwebtoken": "^8.5.1",
"module-alias": "^2.2.2",
Expand Down Expand Up @@ -44,5 +44,5 @@
"start": "node dist/index.js",
"test": "mocha tests/**/*.test.js --reporter mocha-junit-reporter --reporter-options mochaFile=../test_results/ui-service.xml"
},
"version": "2.2.1"
"version": "2.2.2"
}
4 changes: 2 additions & 2 deletions common/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "Envision Blockchain Solutions <[email protected]>",
"dependencies": {
"@guardian/interfaces": "^2.2.1",
"@guardian/interfaces": "^2.2.2",
"nats": "^2.6.1",
"reflect-metadata": "^0.1.13",
"zlib": "^1.0.5"
Expand All @@ -27,5 +27,5 @@
"prepare": "npm run build",
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "2.2.1"
"version": "2.2.2"
}
6 changes: 3 additions & 3 deletions guardian-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
},
"author": "Envision Blockchain Solutions <[email protected]>",
"dependencies": {
"@guardian/common": "^2.2.1",
"@guardian/interfaces": "^2.2.1",
"@guardian/common": "^2.2.2",
"@guardian/interfaces": "^2.2.2",
"@hashgraph/sdk": "^2.15.0",
"@transmute/credentials-context": "^0.7.0-unstable.60",
"@transmute/did-context": "^0.7.0-unstable.60",
Expand Down Expand Up @@ -72,5 +72,5 @@
"test:network": "mocha tests/network-tests/**/*.test.js",
"test:stability": "mocha tests/stability.test.js"
},
"version": "2.2.1"
"version": "2.2.2"
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,13 @@ export class DocumentValidatorBlock {
@ActionCallback({
output: [PolicyOutputEventType.RunEvent, PolicyOutputEventType.RefreshEvent]
})
@CatchErrors()
async runAction(event: IPolicyEvent<any>) {
const ref = PolicyComponentsUtils.GetBlockRef<IPolicyValidatorBlock>(this);
ref.log(`runAction`);

if (!ref.run(event)) {
const valid = await ref.run(event);
if (!valid) {
throw new BlockActionError(`Invalid document`, ref.blockType, ref.uuid);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,36 +147,44 @@ export class RequestVcDocumentBlock {
}

async getRelationships(policyId: string, refId: any): Promise<VcDocumentCollection> {
if (refId) {
let id: string = null;
let documentRef: any = null;
if (typeof (refId) === 'string') {
documentRef = await getMongoRepository(VcDocumentCollection).findOne({
where: {
'policyId': { $eq: policyId },
'document.credentialSubject.id': { $eq: id }
}
});
id = refId;
return documentRef;
} else if (typeof (refId) === 'object') {
if (refId.id) {
documentRef = await getMongoRepository(VcDocumentCollection).findOne(refId.id);
} else {
try {
if (refId) {
let documentRef: any = null;
if (typeof (refId) === 'string') {
documentRef = await getMongoRepository(VcDocumentCollection).findOne({
where: {
'policyId': { $eq: policyId },
'document.credentialSubject.id': { $eq: id }
'document.credentialSubject.id': { $eq: refId }
}
});
} else if (typeof (refId) === 'object') {
if (refId.id) {
documentRef = await getMongoRepository(VcDocumentCollection).findOne(refId.id);
if (documentRef && documentRef.policyId !== policyId) {
documentRef = null;
}
} else {
const id = PolicyUtils.getSubjectId(documentRef);
documentRef = await getMongoRepository(VcDocumentCollection).findOne({
where: {
'policyId': { $eq: policyId },
'document.credentialSubject.id': { $eq: id }
}
});
}
}
if(!documentRef) {
throw new Error('Invalid relationships');
}
id = PolicyUtils.getSubjectId(documentRef);
return documentRef;
} else {
return null;
}
} else {
return null;
} catch (error) {
const ref = PolicyComponentsUtils.GetBlockRef(this);
ref.error(error.message);
throw new BlockActionError('Invalid relationships', ref.blockType, ref.uuid);
}
return null;
}

@ActionCallback({
Expand Down
10 changes: 5 additions & 5 deletions guardian-service/src/policy-engine/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,18 +352,18 @@ export class PolicyUtils {
}

public static checkDocumentSchema(document: any, schema: SchemaCollection): boolean {
const iri = schema.iri;
const iri = schema.iri ? schema.iri.slice(1) : null;
const context = schema.contextURL;
if (document && document.document) {
if (Array.isArray(document.document.credentialSubject)) {
return (
document.document.credentialSubject[0]['@context'].indexOf(context) &&
document.document.credentialSubject[0].type == iri
document.document.credentialSubject[0]['@context'].indexOf(context) > -1 &&
document.document.credentialSubject[0].type === iri
);
} else {
return (
document.document.credentialSubject['@context'].indexOf(context) &&
document.document.credentialSubject.type == iri
document.document.credentialSubject['@context'].indexOf(context) > -1 &&
document.document.credentialSubject.type === iri
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion interfaces/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
"lint": "tslint --project .",
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "2.2.1"
"version": "2.2.2"
}
6 changes: 3 additions & 3 deletions ipfs-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
},
"author": "Envision Blockchain Solutions <[email protected]>",
"dependencies": {
"@guardian/common": "^2.2.1",
"@guardian/interfaces": "^2.2.1",
"@guardian/common": "^2.2.2",
"@guardian/interfaces": "^2.2.2",
"@web-std/fetch": "3.0.0",
"axios": "^0.26.1",
"axios-retry": "^3.2.4",
Expand Down Expand Up @@ -46,5 +46,5 @@
"start": "node dist/index.js",
"test": "mocha tests/**/*.test.js --reporter mocha-junit-reporter --reporter-options mochaFile=../test_results/ipfs-client.xml"
},
"version": "2.2.1"
"version": "2.2.2"
}
6 changes: 3 additions & 3 deletions logger-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"packageManager": "[email protected]",
"author": "Envision Blockchain Solutions <[email protected]>",
"dependencies": {
"@guardian/common": "^2.2.1",
"@guardian/interfaces": "^2.2.1",
"@guardian/common": "^2.2.2",
"@guardian/interfaces": "^2.2.2",
"@web-std/fetch": "3.0.0",
"cors": "^2.8.5",
"dotenv": "^16.0.0",
Expand Down Expand Up @@ -36,5 +36,5 @@
"lint": "tslint --project .",
"start": "node dist/index.js"
},
"version": "2.2.1"
"version": "2.2.2"
}
4 changes: 2 additions & 2 deletions mrv-sender/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "Envision Blockchain Solutions <[email protected]>",
"dependencies": {
"@guardian/common": "^2.2.1",
"@guardian/common": "^2.2.2",
"@transmute/credentials-context": "0.7.0-unstable.40",
"@transmute/did-context": "0.7.0-unstable.40",
"@transmute/ed25519-signature-2018": "0.7.0-unstable.40",
Expand Down Expand Up @@ -29,5 +29,5 @@
"dev:docker": "nodemon .",
"start": "node dist/index.js"
},
"version": "2.2.1"
"version": "2.2.2"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"logger-service",
"mrv-sender"
],
"version": "2.2.1"
"version": "2.2.2"
}
28 changes: 14 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ __metadata:
languageName: node
linkType: hard

"@guardian/common@^2.2.1, @guardian/common@workspace:common":
"@guardian/common@^2.2.2, @guardian/common@workspace:common":
version: 0.0.0-use.local
resolution: "@guardian/common@workspace:common"
dependencies:
"@guardian/interfaces": ^2.2.1
"@guardian/interfaces": ^2.2.2
"@types/node": ^17.0.13
mocha-junit-reporter: ^2.0.2
nats: ^2.6.1
Expand All @@ -184,7 +184,7 @@ __metadata:
languageName: unknown
linkType: soft

"@guardian/interfaces@^2.2.1, @guardian/interfaces@workspace:interfaces":
"@guardian/interfaces@^2.2.2, @guardian/interfaces@workspace:interfaces":
version: 0.0.0-use.local
resolution: "@guardian/interfaces@workspace:interfaces"
dependencies:
Expand Down Expand Up @@ -1597,8 +1597,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "api-gateway@workspace:api-gateway"
dependencies:
"@guardian/common": ^2.2.1
"@guardian/interfaces": ^2.2.1
"@guardian/common": ^2.2.2
"@guardian/interfaces": ^2.2.2
"@types/express": ^4.17.13
"@types/jszip": ^3.4.1
"@types/node": ^17.0.13
Expand Down Expand Up @@ -1769,8 +1769,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "auth-service@workspace:auth-service"
dependencies:
"@guardian/common": ^2.2.1
"@guardian/interfaces": ^2.2.1
"@guardian/common": ^2.2.2
"@guardian/interfaces": ^2.2.2
"@types/jsonwebtoken": ^8.5.4
"@types/node": ^17.0.13
chai: ^4.3.4
Expand Down Expand Up @@ -3957,8 +3957,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "guardian-service@workspace:guardian-service"
dependencies:
"@guardian/common": ^2.2.1
"@guardian/interfaces": ^2.2.1
"@guardian/common": ^2.2.2
"@guardian/interfaces": ^2.2.2
"@hashgraph/sdk": ^2.15.0
"@transmute/credentials-context": ^0.7.0-unstable.60
"@transmute/did-context": ^0.7.0-unstable.60
Expand Down Expand Up @@ -4527,8 +4527,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "ipfs-client@workspace:ipfs-client"
dependencies:
"@guardian/common": ^2.2.1
"@guardian/interfaces": ^2.2.1
"@guardian/common": ^2.2.2
"@guardian/interfaces": ^2.2.2
"@types/fs-extra": ^9.0.12
"@types/js-yaml": ^4.0.3
"@types/node": ^17.0.13
Expand Down Expand Up @@ -5611,8 +5611,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "logger-service@workspace:logger-service"
dependencies:
"@guardian/common": ^2.2.1
"@guardian/interfaces": ^2.2.1
"@guardian/common": ^2.2.2
"@guardian/interfaces": ^2.2.2
"@types/fs-extra": ^9.0.12
"@types/node": ^17.0.13
"@web-std/fetch": 3.0.0
Expand Down Expand Up @@ -6144,7 +6144,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "mrv-sender@workspace:mrv-sender"
dependencies:
"@guardian/common": ^2.2.1
"@guardian/common": ^2.2.2
"@transmute/credentials-context": 0.7.0-unstable.40
"@transmute/did-context": 0.7.0-unstable.40
"@transmute/ed25519-signature-2018": 0.7.0-unstable.40
Expand Down

0 comments on commit 0865752

Please sign in to comment.