refs #6718 fix: loggable and sql
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2024-01-18 10:39:12 +01:00
parent ef2b156b55
commit dfee2b0ce4
7 changed files with 12 additions and 12 deletions

View File

@ -1,4 +1,4 @@
REVOKE UPDATE ON TABLE `vn`.`item` FROM `employee`;
GRANT UPDATE(id, equivalent, stems, minPrice, isToPrint, family, box, category, doPhoto, image, inkFk, intrastatFk, hasMinPrice, created, comment, typeFk, generic, producerFk, description, density, relevancy, expenseFk, isActive, subName, tag5, value5, tag6, value6, tag7, value7, tag8, value8, tag9, value9, tag10, value10, minimum, upToDown, supplyResponseFk, hasKgPrice, isFloramondo, isFragile, numberOfItemsPerCask, embalageCode, quality, stemMultiplier, itemPackingTypeFk, packingOut, genericFk, packingShelve, isLaid, lastUsed, weightByPiece, weightByPiece, editorFk, recycledPlastic, nonRecycledPlastic, minQuantity) ON TABLE vn.item TO employee;
GRANT UPDATE(id, equivalent, stems, minPrice, isToPrint, family, box, category, doPhoto, image, inkFk, intrastatFk, hasMinPrice, created, comment, typeFk, generic, producerFk, description, density, relevancy, expenseFk, isActive, subName, tag5, value5, tag6, value6, tag7, value7, tag8, value8, tag9, value9, tag10, value10, minimum, upToDown, supplyResponseFk, hasKgPrice, isFloramondo, isFragile, numberOfItemsPerCask, embalageCode, quality, stemMultiplier, itemPackingTypeFk, packingOut, genericFk, packingShelve, isLaid, lastUsed, weightByPiece, weightByPiece, editorFk, recycledPlastic, nonRecycledPlastic, minQuantity) ON TABLE `vn`.`item` TO `employee`;

View File

@ -1,4 +1,4 @@
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) VALUES
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId) VALUES
('VnRole','*','READ','ALLOW','ROLE','employee'),
('VnRole','*','WRITE','ALLOW','ROLE','it');

View File

@ -1,2 +1,2 @@
ALTER TABLE vn.productionConfig ADD itemPreviousDefaultSize int NULL COMMENT 'Altura por defecto para los artículos de previa';
UPDATE IGNORE vn.productionConfig SET itemPreviousDefaultSize = 40 WHERE id = 1;
ALTER TABLE `vn`.`productionConfig` ADD itemPreviousDefaultSize int NULL COMMENT 'Altura por defecto para los artículos de previa';
UPDATE IGNORE `vn`.`productionConfig` SET itemPreviousDefaultSize = 40 WHERE id = 1;

View File

@ -1,9 +1,9 @@
UPDATE vn.supplierAccount sa
JOIN vn.country c ON sa.countryFk = c.id AND c.code = 'FR'
UPDATE `vn`.`supplierAccount` sa
JOIN `vn`.`country` c ON sa.countryFk = c.id AND c.code = 'FR'
SET countryFk = c.id
WHERE iban = 'FR7630003012690002801121597';
UPDATE vn.supplierAccount sa
JOIN vn.country c ON sa.countryFk = c.id AND c.code = 'PT'
UPDATE `vn`.`supplierAccount` sa
JOIN `vn`.`country` c ON sa.countryFk = c.id AND c.code = 'PT'
SET countryFk = c.id
WHERE iban = 'PT50001000005813059150168';

View File

@ -1,2 +1,2 @@
ALTER TABLE vn.invoiceOutConfig
ALTER TABLE `vn`.`invoiceOutConfig`
ADD IF NOT EXISTS refLen TINYINT UNSIGNED DEFAULT 5 NOT NULL COMMENT 'Invoice reference identifier length';

View File

@ -270,8 +270,8 @@ class VnMySQL extends MySQL {
isLoggable(model) {
const Model = this.getModelDefinition(model).model;
const settings = Model.definition.settings;
return settings.base && settings.base === 'Loggable';
const {settings} = Model.definition;
return settings?.mixins?.Loggable;
}
invokeMethod(method, args, model, ctx, opts, cb) {
@ -291,7 +291,7 @@ class VnMySQL extends MySQL {
}
try {
const userId = opts.httpCtx && opts.httpCtx.active.accessToken.userId;
const userId = opts.httpCtx && opts.httpCtx.active?.accessToken?.userId;
if (userId) {
const user = await Model.app.models.VnUser.findById(userId, {fields: ['name']}, opts);
await this.executeP(`CALL account.myUser_loginWithName(?)`, [user.name], opts);