From f3193f0dc182d0c6363882a1e6f9951f10fe7816 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Tue, 29 Jun 2021 10:51:01 +0200 Subject: [PATCH 1/3] added businesType model and relation to client --- db/changes/10340-summer/00-ACL.sql | 2 ++ db/changes/10340-summer/deleteMe.keep | 1 - modules/client/back/model-config.json | 3 +++ modules/client/back/models/business-type.json | 18 ++++++++++++++++++ modules/client/back/models/client.json | 5 +++++ 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 db/changes/10340-summer/00-ACL.sql delete mode 100644 db/changes/10340-summer/deleteMe.keep create mode 100644 modules/client/back/models/business-type.json diff --git a/db/changes/10340-summer/00-ACL.sql b/db/changes/10340-summer/00-ACL.sql new file mode 100644 index 0000000000..0dc51f6ef2 --- /dev/null +++ b/db/changes/10340-summer/00-ACL.sql @@ -0,0 +1,2 @@ +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES ('BusinessType', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/db/changes/10340-summer/deleteMe.keep b/db/changes/10340-summer/deleteMe.keep deleted file mode 100644 index 3a94d75a80..0000000000 --- a/db/changes/10340-summer/deleteMe.keep +++ /dev/null @@ -1 +0,0 @@ -Delete me \ No newline at end of file diff --git a/modules/client/back/model-config.json b/modules/client/back/model-config.json index 1f18f4963e..38f5c94272 100644 --- a/modules/client/back/model-config.json +++ b/modules/client/back/model-config.json @@ -8,6 +8,9 @@ "BankEntity": { "dataSource": "vn" }, + "BusinessType": { + "dataSource": "vn" + }, "Client": { "dataSource": "vn" }, diff --git a/modules/client/back/models/business-type.json b/modules/client/back/models/business-type.json new file mode 100644 index 0000000000..ff18c5c769 --- /dev/null +++ b/modules/client/back/models/business-type.json @@ -0,0 +1,18 @@ +{ + "name": "BusinessType", + "base": "VnModel", + "options": { + "mysql": { + "table": "businessType" + } + }, + "properties": { + "code": { + "type": "string", + "id": true + }, + "description": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/modules/client/back/models/client.json b/modules/client/back/models/client.json index b4682579af..1cf539439c 100644 --- a/modules/client/back/models/client.json +++ b/modules/client/back/models/client.json @@ -168,6 +168,11 @@ "model": "ClientType", "foreignKey": "clientTypeFk" }, + "businessType": { + "type": "belongsTo", + "model": "BusinessType", + "foreignKey": "businessTypeFk" + }, "addresses": { "type": "hasMany", "model": "Address", From f30cd1aeda0fae6274039c6b8f2549d10d089204 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Tue, 29 Jun 2021 10:51:27 +0200 Subject: [PATCH 2/3] added business type to client basic data --- e2e/helpers/selectors.js | 1 + e2e/paths/02-client/02_edit_basic_data.spec.js | 8 ++++++++ modules/client/front/basic-data/index.html | 8 ++++++++ modules/client/front/basic-data/locale/es.yml | 3 ++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index ffb45c34e2..cf1b34d3dc 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -152,6 +152,7 @@ export default { salesPerson: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]', channel: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.contactChannelFk"]', transferor: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.transferorFk"]', + businessType: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.businessTypeFk"]', saveButton: 'vn-client-basic-data button[type=submit]' }, clientFiscalData: { diff --git a/e2e/paths/02-client/02_edit_basic_data.spec.js b/e2e/paths/02-client/02_edit_basic_data.spec.js index f35483edfc..3a476e54fa 100644 --- a/e2e/paths/02-client/02_edit_basic_data.spec.js +++ b/e2e/paths/02-client/02_edit_basic_data.spec.js @@ -35,6 +35,7 @@ describe('Client Edit basicData path', () => { await page.write(selectors.clientBasicData.email, 'PWallace@verdnatura.es'); await page.autocompleteSearch(selectors.clientBasicData.channel, 'Rumors on the streets'); await page.autocompleteSearch(selectors.clientBasicData.transferor, 'Max Eisenhardt'); + await page.autocompleteSearch(selectors.clientBasicData.businessType, 'Eventos'); await page.waitToClick(selectors.clientBasicData.saveButton); const message = await page.waitForSnackbar(); @@ -55,6 +56,13 @@ describe('Client Edit basicData path', () => { expect(result).toEqual('David Haller'); }); + it('should confirm the business type have been edited', async() => { + const result = await page + .waitToGetProperty(selectors.clientBasicData.businessType, 'value'); + + expect(result).toEqual('Eventos'); + }); + it('should confirm the email have been edited', async() => { const result = await page .waitToGetProperty(selectors.clientBasicData.email, 'value'); diff --git a/modules/client/front/basic-data/index.html b/modules/client/front/basic-data/index.html index 4a705c3842..2bfab3f108 100644 --- a/modules/client/front/basic-data/index.html +++ b/modules/client/front/basic-data/index.html @@ -20,6 +20,14 @@ rule vn-focus> + + - sin espacios, ejemplo: user@dominio.com, user2@dominio.com siendo el primer correo electrónico el principal Contact: Contacto -Undo changes: Deshacer cambios \ No newline at end of file +Undo changes: Deshacer cambios +Business type: Tipo de negocio \ No newline at end of file From 15c7c0cb4b0f45d805db1ada7a56865a6bb75e53 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Tue, 29 Jun 2021 15:31:58 +0200 Subject: [PATCH 3/3] read acl set on the model --- back/models/account.json | 6 ++++-- modules/client/back/models/business-type.json | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/back/models/account.json b/back/models/account.json index 9cac20bc00..b59cf39c22 100644 --- a/back/models/account.json +++ b/back/models/account.json @@ -80,13 +80,15 @@ "principalType": "ROLE", "principalId": "$everyone", "permission": "ALLOW" - }, { + }, + { "property": "logout", "accessType": "EXECUTE", "principalType": "ROLE", "principalId": "$authenticated", "permission": "ALLOW" - }, { + }, + { "property": "validateToken", "accessType": "EXECUTE", "principalType": "ROLE", diff --git a/modules/client/back/models/business-type.json b/modules/client/back/models/business-type.json index ff18c5c769..e8399ed687 100644 --- a/modules/client/back/models/business-type.json +++ b/modules/client/back/models/business-type.json @@ -14,5 +14,11 @@ "description": { "type": "string" } - } + }, + "acls": [{ + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }] } \ No newline at end of file