Skip to content

Commit

Permalink
Develop (#308)
Browse files Browse the repository at this point in the history
* fix

Signed-off-by: simvalery <[email protected]>

* fix results publishing

Signed-off-by: simvalery <[email protected]>

* fix and badge

Signed-off-by: simvalery <[email protected]>

* add lint run

Signed-off-by: simvalery <[email protected]>

* test CI

Signed-off-by: simvalery <[email protected]>

* test CI

Signed-off-by: simvalery <[email protected]>

* add more actions

Signed-off-by: simvalery <[email protected]>

* fix & test results

Signed-off-by: simvalery <[email protected]>

* fix

Signed-off-by: simvalery <[email protected]>

* fix results publishing

Signed-off-by: simvalery <[email protected]>

* fix and badge

Signed-off-by: simvalery <[email protected]>

* add lint run

Signed-off-by: simvalery <[email protected]>

* add websocket heartbeat

* add version badge

* test

* fix config

* fix badge

* test

* fix config

* fix badge

* Update ReleaseManagementPlan.md

* implement archive

* Update and rename ReleaseManagementPlan.md to RELEASE-MANAGEMENT-PLAN.md

* Create RELEASE-CHECKLIST.md

* new schema format

Signed-off-by: stepankirjakov <[email protected]>

* create and update schemes (new format)

Signed-off-by: stepankirjakov <[email protected]>

* validation form

Signed-off-by: stepankirjakov <[email protected]>

* update import\export schemes

Signed-off-by: stepankirjakov <[email protected]>

* fix find schema

Signed-off-by: stepankirjakov <[email protected]>

* update unit tests

Signed-off-by: stepankirjakov <[email protected]>

* test config

Signed-off-by: stepankirjakov <[email protected]>

* fix schema id

Signed-off-by: stepankirjakov <[email protected]>

* fix request form

Signed-off-by: stepankirjakov <[email protected]>

* fix VC type

Signed-off-by: stepankirjakov <[email protected]>

* fix button

Signed-off-by: stepankirjakov <[email protected]>

* fix uuid for new schema
update example

Signed-off-by: stepankirjakov <[email protected]>

* validate schema;
add utin tests

Signed-off-by: stepankirjakov <[email protected]>

* fix

Signed-off-by: stepankirjakov <[email protected]>

* fix

Signed-off-by: stepankirjakov <[email protected]>

* rename class

Signed-off-by: stepankirjakov <[email protected]>

* fix lint

Signed-off-by: stepankirjakov <[email protected]>

* fix unit tests

Signed-off-by: stepankirjakov <[email protected]>

* get all for policy

* add export policy dialog

* postman config

* design updates for the schema creation dialog

* fix ui

* update schema field name

* export policy

* policy files parser

* fix field description

* add import\export dialog

* fix default schemes

* update export dialog

* update grid

* update request

* update Readme

Signed-off-by: danielnorkin <[email protected]>

* import policy

* fix

* fix unit tests

* fix schema

* add error messaage

* Readme update

* Update RELEASE-MANAGEMENT-PLAN.md

* Updated readme to clarify where to find OPERATOR_ID and OPERATOR_KEY

Signed-off-by: Paul Li <[email protected]>

* Update CHANGELOG.md

* policy validation basic-block.ts

* policy validation

* highlighting invalid blocks

* validation

* setting schema form styles accroding to design

Signed-off-by: artembuslaev <[email protected]>

* fix edit schema description

Signed-off-by: artembuslaev <[email protected]>

* fix color

Signed-off-by: artembuslaev <[email protected]>

* fix id generation

Signed-off-by: simvalery <[email protected]>

* fix column line red to blue

Signed-off-by: artembuslaev <[email protected]>

* highlighting invalid blocks

* handle errors

Signed-off-by: simvalery <[email protected]>

* validate policy by config

Signed-off-by: simvalery <[email protected]>

* fix typing

Signed-off-by: simvalery <[email protected]>

* fix tag finder

Signed-off-by: simvalery <[email protected]>

* validate before publish

Signed-off-by: simvalery <[email protected]>

* highlighting invalid blocks

* highlighting invalid blocks

* update env files

* fix json error

* add codemirror

* policy validation basic-block.ts

* policy validation

* validation

* fix id generation

Signed-off-by: simvalery <[email protected]>

* highlighting invalid blocks

* highlighting invalid blocks

* handle errors

Signed-off-by: simvalery <[email protected]>

* validate policy by config

Signed-off-by: simvalery <[email protected]>

* fix typing

Signed-off-by: simvalery <[email protected]>

* fix tag finder

Signed-off-by: simvalery <[email protected]>

* highlighting invalid blocks

* validate before publish

Signed-off-by: simvalery <[email protected]>

* highlighting invalid blocks

* update env files

* fix json error

* add codemirror

* fix policy results

Signed-off-by: simvalery <[email protected]>

* fix policy results

Signed-off-by: simvalery <[email protected]>

* roles block

Signed-off-by: simvalery <[email protected]>

* fix

Signed-off-by: simvalery <[email protected]>

* policy roles

Signed-off-by: simvalery <[email protected]>

* fix spelling

Signed-off-by: simvalery <[email protected]>

* add ui for custom roles

* update ui for custom roles

* #197 API Development

* adding schema form validation

Signed-off-by: artembuslaev <[email protected]>

* moved date formatting to change value subscription

Signed-off-by: artembuslaev <[email protected]>

* add timeout transactions

* update sdk version;
update tests

Signed-off-by: stepankirjakov <[email protected]>

* deleting preset schemes;
loading system schemes from files

Signed-off-by: stepankirjakov <[email protected]>

* rename folder

Signed-off-by: stepankirjakov <[email protected]>

* policy roles permissions

Signed-off-by: simvalery <[email protected]>

* fix tests

Signed-off-by: simvalery <[email protected]>

* fix

Signed-off-by: simvalery <[email protected]>

* fix

Signed-off-by: simvalery <[email protected]>

* guardian service tests report

Signed-off-by: simvalery <[email protected]>

* remove installer role

Signed-off-by: stepankirjakov <[email protected]>

* fix budgets

Signed-off-by: simvalery <[email protected]>

* fix check current sessions

Signed-off-by: stepankirjakov <[email protected]>

* fix display array field in nested schemas and fix early field validation

Signed-off-by: artembuslaev <[email protected]>

* fix check DID documents

Signed-off-by: stepankirjakov <[email protected]>

* fix docker build

Signed-off-by: simvalery <[email protected]>

* fix

Signed-off-by: simvalery <[email protected]>

* fix error message

Signed-off-by: stepankirjakov <[email protected]>

* fix timeout

Signed-off-by: stepankirjakov <[email protected]>

* update demo policy

Signed-off-by: stepankirjakov <[email protected]>

* fix

Signed-off-by: simvalery <[email protected]>

* #238 Creating a new Installer user with already existing username causes 500 error

* fix height dialog

* fix overlay

Signed-off-by: stepankirjakov <[email protected]>

* fix websocket roles

Signed-off-by: simvalery <[email protected]>

* fix height dialog

Signed-off-by: stepankirjakov <[email protected]>

* change color border line, added a lock on multiple boolean, fix form change datetime fields, change undefined boolean field to "Unset"

Signed-off-by: artembuslaev <[email protected]>

* fix tags validation

Signed-off-by: simvalery <[email protected]>

* fix budgets

Signed-off-by: simvalery <[email protected]>

* fix check current sessions

Signed-off-by: stepankirjakov <[email protected]>

* fix check DID documents

Signed-off-by: stepankirjakov <[email protected]>

* fix docker build

Signed-off-by: simvalery <[email protected]>

* fix

Signed-off-by: simvalery <[email protected]>

* fix error message

Signed-off-by: stepankirjakov <[email protected]>

* fix timeout

Signed-off-by: stepankirjakov <[email protected]>

* update demo policy

Signed-off-by: stepankirjakov <[email protected]>

* fix

Signed-off-by: simvalery <[email protected]>

* #238 Creating a new Installer user with already existing username causes 500 error

* fix height dialog

* fix overlay

Signed-off-by: stepankirjakov <[email protected]>

* fix websocket roles

Signed-off-by: simvalery <[email protected]>

* fix height dialog

Signed-off-by: stepankirjakov <[email protected]>

* fix tags validation

Signed-off-by: simvalery <[email protected]>

* add policy id

Signed-off-by: stepankirjakov <[email protected]>

* set datetime/time fields to 12 hours, fix display inner schema, added invalid field arrow

Signed-off-by: artembuslaev <[email protected]>

* Update API

* update validation roles

* update validation

Signed-off-by: stepankirjakov <[email protected]>

* update api

Signed-off-by: stepankirjakov <[email protected]>

* change invalid field message to error message by field type, set boolean invalid backlight

Signed-off-by: artembuslaev <[email protected]>

* update api

Signed-off-by: stepankirjakov <[email protected]>

* update api

Signed-off-by: stepankirjakov <[email protected]>

* update api

* fix datetime re-validation

Signed-off-by: artembuslaev <[email protected]>

* update api

* delete topic id for new policy
update demo policy

Signed-off-by: stepankirjakov <[email protected]>

* fix readonly fields

Signed-off-by: stepankirjakov <[email protected]>

* set placeholders to fields, set invalid message to each field in form

Signed-off-by: artembuslaev <[email protected]>

* fix form padding

Signed-off-by: stepankirjakov <[email protected]>

* fix placeholder

Signed-off-by: stepankirjakov <[email protected]>

* Update postman API

Signed-off-by: Stepan Kiryakov <[email protected]>

* Update swagger.yaml

* Update Postman collection file

* fix request form size

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix grid max-width

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix

Signed-off-by: simvalery <[email protected]>

* add demo policy zip

Signed-off-by: Stepan Kiryakov <[email protected]>

* updated readme

Signed-off-by: danielnorkin <[email protected]>

* fix

Signed-off-by: simvalery <[email protected]>

* update readme

Signed-off-by: danielnorkin <[email protected]>

* update readme

Signed-off-by: danielnorkin <[email protected]>

* Update readme.md

Signed-off-by: danielnorkin <[email protected]>

* Update readme.md

Signed-off-by: danielnorkin <[email protected]>

* Update readme.md

Signed-off-by: danielnorkin <[email protected]>

* Update CHANGELOG.md

Signed-off-by: danielnorkin <[email protected]>

* bag fixes

Signed-off-by: simvalery <[email protected]>

* fix build

Signed-off-by: simvalery <[email protected]>

* bag fixes: check schema status

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix import tokens
fix header highlight

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix import tokens

Signed-off-by: Stepan Kiryakov <[email protected]>

Co-authored-by: AnVaBr <[email protected]>
Co-authored-by: stepankirjakov <[email protected]>
Co-authored-by: Stepan Kirjakov <[email protected]>
Co-authored-by: danielnorkin <[email protected]>
Co-authored-by: Alex Pyatakov <[email protected]>
Co-authored-by: Paul Li <[email protected]>
Co-authored-by: artembuslaev <[email protected]>
Co-authored-by: Stepan Kiryakov <[email protected]>
Co-authored-by: brandisio <[email protected]>
  • Loading branch information
10 people authored Jan 12, 2022
1 parent c7cd5a0 commit f8cbee1
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 26 deletions.
Binary file modified Demo Artifacts/iRec.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion frontend/src/app/components/header/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class HeaderComponent implements OnInit {
this.linksConfig[UserRole.USER] = [{
name: "Profile",
disabled: false,
link: '/installer-profile'
link: '/user-profile'
}, {
name: "Policies",
disabled: false,
Expand Down
20 changes: 12 additions & 8 deletions ui-service/src/policy-engine/block-tree-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,17 @@ export class BlockTreeGenerator {
*/
stateChangeCb(uuid: string, state: any, user?: IAuthUser) {
this.wss.clients.forEach(async (client: AuthenticatedWebSocket) => {
const policy = await getMongoRepository(Policy).findOne((StateContainer.GetBlockByUUID(uuid) as any).policyId);
const role = policy.registeredUsers[user.did];
if (!role) {
return
}
if (StateContainer.IfUUIDRegistered(uuid) && StateContainer.IfHasPermission(uuid, role, user)) {
client.send(uuid);
try {
const policy = await getMongoRepository(Policy).findOne((StateContainer.GetBlockByUUID(uuid) as any).policyId);
const role = policy.registeredUsers[user.did];
if (!role) {
return
}
if (StateContainer.IfUUIDRegistered(uuid) && StateContainer.IfHasPermission(uuid, role, user)) {
client.send(uuid);
}
} catch (e) {
console.error('WS Error', e);
}

});
Expand Down Expand Up @@ -429,7 +433,7 @@ export class BlockTreeGenerator {
res.status(err.errorObject.code).send(err.errorObject);
return;
}
const data = await block.getData(req.user, req.params.uuid);
const data = await block.getData(req.user, req.params.uuid, req.query);
res.send(data);
} catch (e) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {Users} from '@helpers/users';
import {KeyType, Wallet} from '@helpers/wallet';
import {User} from '@entity/user';
import {PolicyValidationResultsContainer} from '@policy-engine/policy-validation-results-container';
import {SchemaStatus} from 'interfaces';

/**
* Document action clock with UI
Expand Down Expand Up @@ -139,13 +140,23 @@ export class InterfaceDocumentActionBlock {
resultsContainer.addBlockError(ref.uuid, 'Option "targetUrl" does not set');
}

const schemas = await this.guardians.getSchemes({}) || [];
const schemas = await this.guardians.getSchemes() || [];
if (!ref.options.schema) {
resultsContainer.addBlockError(ref.uuid, 'Option "schema" does not set');
} else if (typeof ref.options.schema !== 'string') {
break;
}
if (typeof ref.options.schema !== 'string') {
resultsContainer.addBlockError(ref.uuid, 'Option "schema" must be a string');
} else if (!schemas.find(s => s.uuid === ref.options.schema)) {
resultsContainer.addBlockError(ref.uuid, `Schema with id "${ref.options.schema}" does not exist`)
break;
}
const schema = schemas.find(s => s.uuid === ref.options.schema)
if (!schema) {
resultsContainer.addBlockError(ref.uuid, `Schema with id "${ref.options.schema}" does not exist`);
break;
}
if (schema.status != SchemaStatus.PUBLISHED) {
resultsContainer.addBlockError(ref.uuid, `Schema with id "${ref.options.schema}" does not published`);
break;
}
break;

Expand Down
26 changes: 18 additions & 8 deletions ui-service/src/policy-engine/blocks/request-vc-document-block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { BlockStateUpdate } from '@policy-engine/helpers/decorators';
import { PolicyBlockHelpers } from '@policy-engine/helpers/policy-block-helpers';
import { PolicyBlockStateData } from '@policy-engine/interfaces';
import { StateContainer } from '@policy-engine/state-container';
import { Schema } from 'interfaces';
import { Schema, SchemaStatus } from 'interfaces';
import { HederaHelper, HederaUtils } from 'vc-modules';
import { IAuthUser } from '../../auth/auth.interface';
import { EventBlock } from '../helpers/decorators/event-block';
import {PolicyValidationResultsContainer} from '@policy-engine/policy-validation-results-container';
import { PolicyValidationResultsContainer } from '@policy-engine/policy-validation-results-container';

@EventBlock({
blockType: 'requestVcDocument',
Expand Down Expand Up @@ -47,7 +47,7 @@ export class RequestVcDocumentBlock {

async getData(user: IAuthUser): Promise<any> {
const options = PolicyBlockHelpers.GetBlockUniqueOptionsObject(this);
if(!this.schema) {
if (!this.schema) {
const schemas = await this.guardians.getSchemes({}) || [];
this.schema = Schema.mapRef(schemas).find(s => s.uuid === options.schema);
}
Expand Down Expand Up @@ -96,7 +96,7 @@ export class RequestVcDocumentBlock {

await this.update(Object.assign(StateContainer.GetBlockState((this as any).uuid, user), { data }), user);

if(ref.options.stopPropagation) {
if (ref.options.stopPropagation) {
return {};
}

Expand Down Expand Up @@ -148,13 +148,23 @@ export class RequestVcDocumentBlock {
const ref = PolicyBlockHelpers.GetBlockRef(this);

// Test schema options
const schemas = await this.guardians.getSchemes({}) || [];
const schemas = await this.guardians.getSchemes() || [];
if (!ref.options.schema) {
resultsContainer.addBlockError(ref.uuid, 'Option "schema" does not set');
} else if (typeof ref.options.schema !== 'string') {
return;
}
if (typeof ref.options.schema !== 'string') {
resultsContainer.addBlockError(ref.uuid, 'Option "schema" must be a string');
} else if (!schemas.find(s => s.uuid === ref.options.schema)) {
resultsContainer.addBlockError(ref.uuid, `Schema with id "${ref.options.schema}" does not exist`)
return;
}
const schema = schemas.find(s => s.uuid === ref.options.schema)
if (!schema) {
resultsContainer.addBlockError(ref.uuid, `Schema with id "${ref.options.schema}" does not exist`);
return;
}
if (schema.status != SchemaStatus.PUBLISHED) {
resultsContainer.addBlockError(ref.uuid, `Schema with id "${ref.options.schema}" does not published`);
return;
}
}
}
12 changes: 8 additions & 4 deletions ui-service/src/policy-engine/import-export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@ importExportAPI.post('/import', async (req: AuthenticatedRequest, res: Response)

const dateNow = '_' + Date.now();

const existingTokens = await guardians.getTokens({});
const existingSchemas = await guardians.getSchemes({});
const existingTokens = await guardians.getTokens();
const existingSchemas = await guardians.getSchemes();

const existingTokensMap = {};
existingTokens.forEach(token => existingTokensMap[token.tokenId] = true);
tokens = tokens.filter((token:any) => !existingTokensMap[token.tokenId]);
for (let token of tokens) {
delete token.id;
delete token.selected;
}
tokens = tokens.filter(token => existingTokens.includes(token.tokenId));
tokens = tokens.map(t => existingTokens.find(_t => t.tokenId === _t.tokenId));

for (let schema of schemas) {
const oldUUID = schema.uuid;
Expand All @@ -65,6 +68,7 @@ importExportAPI.post('/import', async (req: AuthenticatedRequest, res: Response)
}
schema.uuid = newUUID;
policy = JSON.parse(JSON.stringify(policy).replace(new RegExp(oldUUID, 'g'), newUUID));
schema.document = schema.document.replace(new RegExp(oldUUID, 'g'), newUUID);
}

const policyRepository = getMongoRepository(Policy);
Expand Down
2 changes: 1 addition & 1 deletion ui-service/src/policy-engine/policy-engine.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ export interface IPolicyInterfaceBlock extends IPolicyBlock {

setData(user: IAuthUser | null, data: any): Promise<any>;

getData(user: IAuthUser | null, uuid: string): Promise<any>;
getData(user: IAuthUser | null, uuid: string, queryParams?: any): Promise<any>;
}

0 comments on commit f8cbee1

Please sign in to comment.