ACL's
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2022-09-30 13:54:20 +02:00
parent 1ac35c0b68
commit 3b0f1efbf4
25 changed files with 54 additions and 32 deletions

View File

@ -2,20 +2,22 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp
VALUES
('ClientConsumptionQueue', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('Ticket', 'deliveryNotePdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Ticket', 'deliveryNoteEmail', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Ticket', 'deliveryNoteEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('Client', 'campaignMetricsPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'campaignMetricsEmail', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'campaignMetricsEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('Client', 'clientWelcomeHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'clientWelcomeEmail', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'clientWelcomeEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),,
('Client', 'creditRequestHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'creditRequestEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('Client', 'printerSetupHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'printerSetupEmail', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'sepaCoreEmail', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'printerSetupEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('Client', 'sepaCoreEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('Client', 'letterDebtorStHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'letterDebtorStEmail', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'letterDebtorStEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('Client', 'letterDebtorNdHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'letterDebtorNdEmail', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'letterDebtorNdEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('Client', 'clientDebtStatementHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'clientDebtStatementEmail', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'clientDebtStatementEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('Client', 'incotermsAuthorizationHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'incotermsAuthorizationEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('Client', 'consumptionSendQueued', 'WRITE', 'ALLOW', 'ROLE', 'system'),
@ -28,7 +30,9 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp
('Travel', 'extraCommunityEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('Entry', 'entryOrderPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
('OsTicket', 'osTicketReportEmail', 'WRITE', 'ALLOW', 'ROLE', 'system'),
('Item', 'buyerWasteEmail', 'WRITE', 'ALLOW', 'ROLE', 'system');
('Item', 'buyerWasteEmail', 'WRITE', 'ALLOW', 'ROLE', 'system'),
('Claim', 'claimPickupPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Claim', 'claimPickupEmail', 'WRITE', 'ALLOW', 'ROLE', 'claimManager');
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
VALUES ('Sector','*','READ','ALLOW','ROLE','employee');

View File

@ -3,4 +3,4 @@ alter table `vn`.`sample`
UPDATE vn.sample t
SET t.model = 'Clients'
WHERE t.id IN(13, 14, 15, 16, 18, 19, 20);
WHERE t.id IN(12, 13, 14, 15, 16, 18, 19, 20);

View File

@ -5,8 +5,6 @@
<slot-menu>
<vn-item
ng-click="$ctrl.showPickupOrder()"
vn-acl="salesPerson"
vn-acl-action="remove"
translate>
Show Pickup order
</vn-item>

View File

@ -3,6 +3,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('campaignMetricsEmail', {
description: 'Sends the campaign metrics email with an attached PDF',
accessType: 'WRITE',
accepts: [
{
arg: 'id',

View File

@ -3,6 +3,7 @@ const {Report} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('campaignMetricsPdf', {
description: 'Returns the campaign metrics pdf',
accessType: 'READ',
accepts: [
{
arg: 'id',

View File

@ -3,6 +3,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('clientDebtStatementEmail', {
description: 'Sends the client debt statement email with an attached PDF',
accessType: 'WRITE',
accepts: [
{
arg: 'id',

View File

@ -3,6 +3,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('clientDebtStatementHtml', {
description: 'Returns the client debt statement email preview',
accessType: 'READ',
accepts: [
{
arg: 'id',

View File

@ -3,6 +3,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('clientWelcomeEmail', {
description: 'Sends the client welcome email with an attached PDF',
accessType: 'WRITE',
accepts: [
{
arg: 'id',

View File

@ -3,6 +3,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('clientWelcomeHtml', {
description: 'Returns the client welcome email preview',
accessType: 'READ',
accepts: [
{
arg: 'id',

View File

@ -3,6 +3,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('clientCreditEmail', {
description: 'Sends the credit request email with an attached PDF',
accessType: 'WRITE',
accepts: [
{
arg: 'id',

View File

@ -3,6 +3,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('creditRequestHtml', {
description: 'Returns the credit request email preview',
accessType: 'READ',
accepts: [
{
arg: 'id',

View File

@ -3,6 +3,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('letterDebtorNdEmail', {
description: 'Sends the second debtor letter email with an attached PDF',
accessType: 'WRITE',
accepts: [
{
arg: 'id',

View File

@ -3,6 +3,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('letterDebtorNdHtml', {
description: 'Returns the second letter debtor email preview',
accessType: 'READ',
accepts: [
{
arg: 'id',

View File

@ -3,6 +3,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('letterDebtorStEmail', {
description: 'Sends the printer setup email with an attached PDF',
accessType: 'WRITE',
accepts: [
{
arg: 'id',

View File

@ -3,6 +3,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('letterDebtorStHtml', {
description: 'Returns the letter debtor email preview',
accessType: 'READ',
accepts: [
{
arg: 'id',

View File

@ -3,6 +3,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('printerSetupEmail', {
description: 'Sends the printer setup email with an attached PDF',
accessType: 'WRITE',
accepts: [
{
arg: 'id',

View File

@ -3,6 +3,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('printerSetupHtml', {
description: 'Returns the printer setup email preview',
accessType: 'READ',
accepts: [
{
arg: 'id',

View File

@ -3,6 +3,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('sepaCoreEmail', {
description: 'Sends the campaign metrics email with an attached PDF',
accessType: 'WRITE',
accepts: [
{
arg: 'id',

View File

@ -1,4 +1,3 @@
const got = require('got');
const UserError = require('vn-loopback/util/user-error');
const getFinalState = require('vn-loopback/util/hook').getFinalState;
const isMultiple = require('vn-loopback/util/hook').isMultiple;
@ -292,23 +291,22 @@ module.exports = Self => {
const $t = httpRequest.__;
const headers = httpRequest.headers;
const origin = headers.origin;
const authorization = headers.authorization;
const salesPersonId = instance.salesPersonFk;
if (salesPersonId) {
// Send email to client
if (instance.email) {
const {Email} = require('vn-print');
const worker = await models.EmailUser.findById(salesPersonId);
const params = {
authorization: authorization,
id: instance.id,
recipientId: instance.id,
recipient: instance.email,
replyTo: worker.email
};
await got.get(`${origin}/api/email/payment-update`, {
searchParams: params
});
const email = new Email('payment-update', params);
await email.send();
}
const fullUrl = `${origin}/#!/client/${instance.id}/billing-data`;

View File

@ -3,6 +3,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('deliveryNoteEmail', {
description: 'Sends the delivery note email with an attached PDF',
accessType: 'WRITE',
accepts: [
{
arg: 'id',

View File

@ -3,6 +3,7 @@ const {Report} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('deliveryNotePdf', {
description: 'Returns the delivery note pdf',
accessType: 'READ',
accepts: [
{
arg: 'id',

View File

@ -29,7 +29,7 @@ module.exports = {
for (let attachment of options.attachments) {
const fileName = attachment.filename;
const filePath = attachment.path;
if (fileName.includes('.png')) return;
if (fileName.includes('.png')) continue;
if (fileName || filePath)
attachments.push(filePath ? filePath : fileName);

View File

@ -1,8 +1,12 @@
const Stylesheet = require(`${appPath}/core/stylesheet`);
const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([
`${appPath}/common/css/spacing.css`,
`${appPath}/common/css/misc.css`,
`${appPath}/common/css/layout.css`,
`${appPath}/common/css/email.css`])
`${vnPrintPath}/common/css/spacing.css`,
`${vnPrintPath}/common/css/misc.css`,
`${vnPrintPath}/common/css/layout.css`,
`${vnPrintPath}/common/css/email.css`])
.mergeStyles();

View File

@ -1,11 +1,11 @@
const Component = require(`${appPath}/core/component`);
const Component = require(`vn-print/core/component`);
const emailHeader = new Component('email-header');
const emailFooter = new Component('email-footer');
module.exports = {
name: 'payment-update',
async serverPrefetch() {
this.payMethod = await this.fetchPayMethod(this.recipientId);
this.payMethod = await this.fetchPayMethod(this.id);
if (!this.payMethod)
throw new Error('Something went wrong');
@ -16,8 +16,8 @@ module.exports = {
},
},
methods: {
fetchPayMethod(clientId) {
return this.findOneFromDef('payMethod', [clientId]);
fetchPayMethod(id) {
return this.findOneFromDef('payMethod', [id]);
}
},
components: {
@ -25,9 +25,10 @@ module.exports = {
'email-footer': emailFooter.build()
},
props: {
recipientId: {
id: {
type: [Number, String],
required: true
required: true,
description: 'The client id'
}
}
};

View File

@ -17,7 +17,7 @@
<tbody>
<tr>
<td class="font gray uppercase">{{$t('claimId')}}</td>
<th>{{claimId}}</th>
<th>{{id}}</th>
</tr>
<tr>
<td class="font gray uppercase">{{$t('clientId')}}</td>
@ -85,7 +85,7 @@
</div>
<!-- Footer block -->
<report-footer id="pageFooter"
v-bind:left-text="$t('claim', [claimId])"
v-bind:left-text="$t('claim', [id])"
v-bind:center-text="client.name"
v-bind="$props">
</report-footer>