fixes #4074 Descargar ACL del usuario actual #1255

Closed
pau wants to merge 40 commits from 4074-download-user-ACL into dev
3 changed files with 5 additions and 4 deletions
Showing only changes of commit 827fc7bacd - Show all commits

View File

@ -1,9 +1,9 @@
module.exports = Self => { module.exports = Self => {
Self.remoteMethodCtx('userAcl', { Self.remoteMethod('userAcl', {
description: 'Get all of the current user permissions', description: 'Get all of the current user permissions',
accepts: { accepts: {
arg: 'roles', arg: 'roles',
type: 'any', type: ['string'],
required: true, required: true,
}, },
returns: { returns: {
@ -17,6 +17,6 @@ module.exports = Self => {
}); });
Self.userAcl = async function(roles) { Self.userAcl = async function(roles) {
return Self.app.models.ACL.find({principalId: {inq: {roles}}}, null); return Self.rawSql(`SELECT * FROM salix.ACL a WHERE a.principalId IN (?)`, [roles]);
}; };
}; };

View File

@ -10,6 +10,7 @@ module.exports = function(Self) {
require('../methods/vn-user/recover-password')(Self); require('../methods/vn-user/recover-password')(Self);
require('../methods/vn-user/validate-token')(Self); require('../methods/vn-user/validate-token')(Self);
require('../methods/vn-user/privileges')(Self); require('../methods/vn-user/privileges')(Self);
require('../methods/vn-user/user-acl')(Self);
// Validations // Validations

View File

@ -21,7 +21,7 @@ class AclService {
} }
this.acls = {}; this.acls = {};
await this.$http.post('Accounts/user/acl', await this.$http.post('VnUsers/user/acl',
{roles: Object.keys(this.roles)}).then(res => { {roles: Object.keys(this.roles)}).then(res => {
res.data.forEach(acl => { res.data.forEach(acl => {
this.acls[acl.model] = this.acls[acl.model] || {}; this.acls[acl.model] = this.acls[acl.model] || {};