From 45bcf8043f03cb4eea2a621abb5c59af38661e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Thu, 7 Mar 2024 19:03:57 +0100 Subject: [PATCH 1/5] feat: permissions to vn.entry.isBooked refs#6724 --- db/versions/10944-tealLaurel/00-firstScript.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 db/versions/10944-tealLaurel/00-firstScript.sql diff --git a/db/versions/10944-tealLaurel/00-firstScript.sql b/db/versions/10944-tealLaurel/00-firstScript.sql new file mode 100644 index 000000000..d11bcb333 --- /dev/null +++ b/db/versions/10944-tealLaurel/00-firstScript.sql @@ -0,0 +1,10 @@ + + REVOKE UPDATE ON vn.entry FROM entryEditor; + GRANT UPDATE ON vn.entry TO administrative; + + GRANT UPDATE (id, supplierFk, dated, invoiceNumber, isExcludedFromAvailable, + isConfirmed, isOrdered, isRaid,commission, created, evaNotes, travelFk, + currencyFk,companyFk, gestDocFk, invoiceInFk, isBlocked, loadPriority, + kop, sub, pro, auction, invoiceAmount, buyerFk, typeFk, reference, + observationEditorFk, clonedFrom, editorFk, lockerUserFk, locked + ) ON vn.entry TO entryEditor; From a62e189e470a2cfa8f0ff3e5e032e1de4835525f Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 28 Mar 2024 16:10:52 +0100 Subject: [PATCH 2/5] feat: refs #6724 hook added --- modules/entry/back/models/entry.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/entry/back/models/entry.js b/modules/entry/back/models/entry.js index 6148ae559..9d5cd4e1f 100644 --- a/modules/entry/back/models/entry.js +++ b/modules/entry/back/models/entry.js @@ -46,4 +46,15 @@ module.exports = Self => { } } }); + + Self.observe('before delete', async function(ctx) { + let isBooked = ctx.instance && ctx.instance.isBooked; + + if (isBooked === undefined) { + const entryInstance = await Self.findById(ctx.where.id); + isBooked = entryInstance.isBooked; + } + + if (isBooked) throw new Error('Booked entry cannot be deleted'); + }); }; From 5c524ecc7db005c933f0d6657ed86ad8daca9c01 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 15 Apr 2024 13:13:40 +0200 Subject: [PATCH 3/5] rollback: refs #6724 entry.js --- modules/entry/back/models/entry.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/modules/entry/back/models/entry.js b/modules/entry/back/models/entry.js index 9d5cd4e1f..6148ae559 100644 --- a/modules/entry/back/models/entry.js +++ b/modules/entry/back/models/entry.js @@ -46,15 +46,4 @@ module.exports = Self => { } } }); - - Self.observe('before delete', async function(ctx) { - let isBooked = ctx.instance && ctx.instance.isBooked; - - if (isBooked === undefined) { - const entryInstance = await Self.findById(ctx.where.id); - isBooked = entryInstance.isBooked; - } - - if (isBooked) throw new Error('Booked entry cannot be deleted'); - }); }; From 0f26fb46b6f0127b1bcf4b54b1656749fb5dd8f7 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 15 Apr 2024 13:16:36 +0200 Subject: [PATCH 4/5] feat: refs #6724 Grant changes --- .../10944-tealLaurel/00-firstScript.sql | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/db/versions/10944-tealLaurel/00-firstScript.sql b/db/versions/10944-tealLaurel/00-firstScript.sql index d11bcb333..2d61cde90 100644 --- a/db/versions/10944-tealLaurel/00-firstScript.sql +++ b/db/versions/10944-tealLaurel/00-firstScript.sql @@ -1,10 +1,8 @@ - - REVOKE UPDATE ON vn.entry FROM entryEditor; - GRANT UPDATE ON vn.entry TO administrative; - - GRANT UPDATE (id, supplierFk, dated, invoiceNumber, isExcludedFromAvailable, - isConfirmed, isOrdered, isRaid,commission, created, evaNotes, travelFk, - currencyFk,companyFk, gestDocFk, invoiceInFk, isBlocked, loadPriority, - kop, sub, pro, auction, invoiceAmount, buyerFk, typeFk, reference, - observationEditorFk, clonedFrom, editorFk, lockerUserFk, locked - ) ON vn.entry TO entryEditor; +REVOKE UPDATE ON vn.entry FROM entryEditor; +GRANT UPDATE ON vn.entry TO administrative; +GRANT UPDATE (id, supplierFk, dated, invoiceNumber, isExcludedFromAvailable, + isConfirmed, isOrdered, isRaid,commission, created, evaNotes, travelFk, + currencyFk,companyFk, gestDocFk, invoiceInFk, loadPriority, + kop, sub, pro, auction, invoiceAmount, buyerFk, typeFk, reference, + observationEditorFk, clonedFrom, editorFk, lockerUserFk, locked +) ON vn.entry TO entryEditor; From 339c349ed037c6454e585c7e5b6a876465ec5365 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 15 Apr 2024 14:00:54 +0200 Subject: [PATCH 5/5] feat: refs #6724 Added admon acl to vn-check --- modules/entry/front/basic-data/index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/entry/front/basic-data/index.html b/modules/entry/front/basic-data/index.html index 6bccb0b5f..57de1c5f7 100644 --- a/modules/entry/front/basic-data/index.html +++ b/modules/entry/front/basic-data/index.html @@ -123,7 +123,9 @@ + ng-model="$ctrl.entry.isBooked" + vn-acl="administrative" + >