Skip to content

Commit

Permalink
2.2.1 hotfix (#1062)
Browse files Browse the repository at this point in the history
* #1051 Created token api return all tokens from other StandardRegistry
fixed issue with filters for trust chain

* #1055 Update block permissions

* #1055 Update block permissions

* GitBook: [#116] Corrected Updated Schema API

* GitBook: [#115] Added documentValidatorBlock

Co-authored-by: Stepan Kiryakov <[email protected]>
Co-authored-by: prernaa.agarwal <[email protected]>
  • Loading branch information
3 people authored Jul 7, 2022
1 parent b452ce2 commit 571fa0f
Show file tree
Hide file tree
Showing 49 changed files with 940 additions and 196 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.0",
"version": "2.2.1",
"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.0",
"@guardian/interfaces": "^2.2.0",
"@guardian/common": "^2.2.1",
"@guardian/interfaces": "^2.2.1",
"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.0"
"version": "2.2.1"
}
9 changes: 8 additions & 1 deletion api-gateway/src/api/service/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,18 @@ tokenAPI.post('/', permissionHelper(UserRole.STANDARD_REGISTRY), async (req: Aut
res.status(500).json({ code: 500, message: 'User not registered' });
return;
}
const tokens = (await guardians.setToken({

let tokens = (await guardians.setToken({
token: req.body,
owner: user.did
}));

tokens = await guardians.getTokens({
did: user.did
});

tokens = tokens || [];

await setTokensPolicies(tokens, user);
res.status(201).json(tokens);
} catch (error) {
Expand Down
10 changes: 3 additions & 7 deletions api-gateway/src/api/service/websockets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class WebSocketsService {
this.channel.response<IErrorBlockMessage, any>('block-error', async (msg) => {
this.wss.clients.forEach((client: any) => {
try {
if (client.user.did === msg.user.did) {
if (client.user && msg.user && client.user.did === msg.user.did) {
client.send(JSON.stringify({
type: 'error-event',
data: {
Expand All @@ -154,7 +154,7 @@ export class WebSocketsService {
console.log('update-user-info');
this.wss.clients.forEach((client: any) => {
try {
if (client.user.did === msg.user.did) {
if (client.user && msg.user && client.user.did === msg.user.did) {
client.send(JSON.stringify({
type: 'update-user-info-event',
data: msg
Expand Down Expand Up @@ -205,11 +205,7 @@ export class WebSocketsService {
this.channel.response<IUpdateUserBalanceMessage, any>('update-user-balance', async (msg) => {
this.wss.clients.forEach((client: any) => {
try {
if (
client.user &&
msg.user &&
client.user.username === msg.user.username
) {
if (client.user && msg.user && client.user.username === msg.user.username) {
client.send(JSON.stringify({
type: 'PROFILE_BALANCE',
data: msg
Expand Down
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.0",
"@guardian/interfaces": "^2.2.0",
"@guardian/common": "^2.2.1",
"@guardian/interfaces": "^2.2.1",
"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.0"
"version": "2.2.1"
}
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.0",
"@guardian/interfaces": "^2.2.1",
"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.0"
"version": "2.2.1"
}
Binary file added docs/.gitbook/assets/image (13) (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/.gitbook/assets/image (13).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/image (23).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
* [revokeBlock](available-policy-workflow-blocks/revokeblock.md)
* [setRelationshipsBlock](available-policy-workflow-blocks/setrelationshipsblock.md)
* [buttonBlock](available-policy-workflow-blocks/buttonblock.md)
* [documentValidatorBlock](available-policy-workflow-blocks/documentvalidatorblock.md)
* [Events](available-policy-workflow-blocks/events.md)

## Policy Workflow Creation using the Guardian User Interface
Expand Down
52 changes: 52 additions & 0 deletions docs/available-policy-workflow-blocks/documentvalidatorblock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# documentValidatorBlock

This Block is to validate documents, including linked documents. This block returns an error if at least one of the checks don’t pass. It can be placed as a ‘child’ document, or as a link in the sequence of the blocks.

![](<../.gitbook/assets/image (13).png>)

### Properties

| Block Property | Definition | Example Input | Status |
| --------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | ------ |
| tag | Unique name for the logic block. | documentValidatorBlock | |
| permissions | Which entity has rights to interact at this part of the workflow. | VVB | |
| defaultActive | Shows whether this block is active at this time and whether it needs to be shown. | Checked or unchecked. | |
| On errors | Called if the system error has occurs in the Block | <p></p><ul><li>No action</li><li>Retry</li><li>Go to step</li><li>Go to tag</li></ul> | |
| stop Propagation | End processing here, don't pass control to the next block. | Checked or unchecked. | |
| DocumentType | Type of the documents to be validated. | <p>· VC Document</p><p>· VP Document</p><p>· Related VC<br>Document</p><p>. Related VP Document</p> | |
| Check Schema | Validates schema documents. | Schema | |
| Check Own Document | If ‘true’ validates document owners. | True / False | |
| Check Assign Document | If ‘true’ validates document owners. | True / False | |
| Conditions | Array containing conditions for validation. | Array | |



![](<../.gitbook/assets/image (23).png>)

### Document Type

The following document types are supported:

1. VC Document : validates the main document and its type (Verifiable Credential).
2. VP Document : validates the main document and its type (Verifiable Presentation).
3. Related VC Document : validates the document linked to the main document and its type (Verifiable Credential)
4. Related VP Document : validates the document linked to the main document and its type (Verifiable Presentation)

### Conditions

#### Condition N

#### Type:

1. Equal – resolves to ‘true’ if value of the field is equal the the content of the Value parameter.
2. Not Equal – resolves to ‘true’ if value of the field is NOT equal the the content of the Value parameter.
3. In – resolves to ‘true’ if value of the field is present the the array.
4. Not In – resolves to ‘true’ if value of the field is present the the array.

#### Field :&#x20;

This field of the document to validates the Value parameter.

#### Value:

The content of this parameter is compared to the content of the Field.
2 changes: 2 additions & 0 deletions docs/available-policy-workflow-blocks/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ Starting with the [Wikipedia definition](https://en.wikipedia.org/wiki/Workflow\
| revokeBlock | This Block finds related messages in policy topics, and revokes those messages and sends it to Hedera topic, but it doesn’t save documents in DB | [revokeblock.md](revokeblock.md "mention") |
| setRelationshipsBlock | Contains DocumentSourceAddOn Block and set relationships for input document. | [setrelationshipsblock.md](setrelationshipsblock.md "mention") |
| buttonBlock | Block responsible for creating buttons | [buttonblock.md](buttonblock.md "mention") |
| documentValidatorBlock | Block to validate documents, including linked documents | [documentvalidatorblock.md](documentvalidatorblock.md "mention") |

Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Updating schema
# Updating Schema

### UPDATING SCHEMA BASED ON SCHEMA ID

{% swagger method="get" path="" baseUrl="/schemas/{schemaId}" summary="Updates the schema" %}
{% swagger method="put" path="" baseUrl="/schemas/{schemaId}" summary="Updates the schema" %}
{% swagger-description %}
Updates the schema with the provided schema ID. Only users with the Standard Registry role are allowed to make the request.
Updates the schema matching the id in the request body. Only users with the Standard Registry role are allowed to make the request.
{% endswagger-description %}

{% swagger-parameter in="path" name="schemaID" type="String" required="true" %}
Schema ID
{% endswagger-parameter %}

{% swagger-parameter in="body" type="schema" required="true" %}
Object that contains a valid schema
Object that contains a valid schema including the id of the schema that is to be update
{% endswagger-parameter %}

{% swagger-response status="200: OK" description="Succesful Operation" %}
Expand Down
2 changes: 1 addition & 1 deletion docs/schema-flow/schema-demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To display System / Policy Schemas in the GUI, we have added a toggle in the Sch

Whenever an account is created, System Schemas are generated automatically.

![](<../.gitbook/assets/image (13).png>)
![](<../.gitbook/assets/image (13) (1).png>)

{% hint style="info" %}
Note: By default System Schemas cannot be edited / deleted.
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@
"test": "ng test",
"watch": "ng build --watch --configuration development --output-path ../www-data"
},
"version": "2.2.0"
"version": "2.2.1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,22 @@ form {
color: #000;
font-size: 20px;
margin-bottom: 20px;
max-width: 600px;
max-width: 720px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
margin-left: 8px;
}

.field-long-value {
color: #000;
font-size: 20px;
margin-bottom: 20px;
max-width: 720px;
overflow: hidden;
margin-left: 8px;
}

.field-name {
margin-bottom: 12px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

<div class="field">
<div class="field-name">Creator</div>
<div class="field-value">{{policy.owner}}</div>
<div class="field-value" [title]="policy.owner">{{policy.owner}}</div>
</div>

<div class="delimiter"></div>
Expand All @@ -64,7 +64,7 @@

<div *ngIf="schemas" class="field-last">
<div class="field-name">Schemas Overview</div>
<div class="field-value">{{schemas}}</div>
<div class="field-long-value">{{schemas}}</div>
</div>

<div *ngIf="tokens" class="delimiter"></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<!-- UI Prop -->
<table class="properties" [attr.readonly]="readonly" *ngIf="block">
<tr class="propRow">
<td class="propRowCol"></td>
<td class="propRowCell cellName">Document Type</td>
<td class="propRowCell">
<mat-select [(value)]="block.documentType" [disabled]="readonly">
<mat-option value="vc-document">VC Document</mat-option>
<mat-option value="vp-document">VP Document</mat-option>
<mat-option value="related-vc-document">Related VC Document</mat-option>
<mat-option value="related-vp-document">Related VP Document</mat-option>
</mat-select>
</td>
</tr>
<tr class="propRow">
<td class="propRowCol"></td>
<td class="propRowCell cellName">Check Schema</td>
<td class="propRowCell">
<mat-select [(value)]="block.schema" [disabled]="readonly">
<mat-option *ngFor="let schema of schemas" [value]="schema.iri">
{{schema.name}}
<span *ngIf="schema.version"> ({{schema.version}})</span>
<span *ngIf="schema.status"> ({{schema.status}})</span>
</mat-option>
</mat-select>
</td>
</tr>
<tr class="propRow">
<td class="propRowCol"></td>
<td class="propRowCell cellName">Check Owner Document</td>
<td class="propRowCell">
<input type="checkbox" [(ngModel)]="block.checkOwnerDocument" [readonly]="readonly">
</td>
</tr>
<tr class="propRow">
<td class="propRowCol"></td>
<td class="propRowCell cellName">Check Assign Document</td>
<td class="propRowCell">
<input type="checkbox" [(ngModel)]="block.checkAssignDocument" [readonly]="readonly">
</td>
</tr>
<tr class="propHeader">
<td class="propRowCol" (click)="onHide(propHidden, 'conditionsGroup')"
[attr.collapse]="propHidden.conditionsGroup">
<mat-icon>
expand_more
</mat-icon>
</td>
<td class="propHeaderCell cellName">Conditions</td>
<td class="propHeaderCell">
<div class="propAdd" (click)="addCondition()">
<mat-icon>add</mat-icon>
<span>Add Condition</span>
</div>
</td>
</tr>
<ng-container *ngFor="let condition of block.conditions; let i=index">
<tr class="propRow" [attr.collapse]="propHidden.conditionsGroup">
<td class="propRowCol" (click)="onHide(propHidden.conditions, i)"
[attr.collapse]="propHidden.conditions[i]">
<mat-icon>
expand_more
</mat-icon>
</td>
<td class="propRowCell cellName">Condition {{i}}</td>
<td class="propRowCell">
<span *ngIf="condition.field && condition.type && condition.value">
{{condition.field}} {{condition.type}} {{condition.value}}
</span>
</td>
</tr>
<tr class="propRow subRow" [attr.collapse]="propHidden.conditionsGroup || propHidden.conditions[i]">
<td class="propRowCol"></td>
<td class="propRowCell cellName">Type</td>
<td class="propRowCell">
<mat-select [(value)]="condition.type" [disabled]="readonly">
<mat-option value="equal">Equal</mat-option>
<mat-option value="not_equal">Not Equal</mat-option>
<mat-option value="in">In</mat-option>
<mat-option value="not_in">Not In</mat-option>
</mat-select>
</td>
</tr>
<tr class="propRow subRow" [attr.collapse]="propHidden.conditionsGroup || propHidden.conditions[i]">
<td class="propRowCol"></td>
<td class="propRowCell cellName">Field</td>
<td class="propRowCell">
<input [(ngModel)]="condition.field" [readonly]="readonly">
</td>
</tr>
<tr class="propRow subRow" [attr.collapse]="propHidden.conditionsGroup || propHidden.conditions[i]">
<td class="propRowCol"></td>
<td class="propRowCell cellName">Value</td>
<td class="propRowCell">
<input [(ngModel)]="condition.value" [readonly]="readonly">
</td>
</tr>
</ng-container>
</table>
Loading

0 comments on commit 571fa0f

Please sign in to comment.