refs #4074 vn-user refactored
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alexandre Riera 2023-04-19 09:07:23 +02:00
parent 4479a47b7b
commit 827fc7bacd
3 changed files with 5 additions and 4 deletions

View File

@ -1,9 +1,9 @@
module.exports = Self => {
Self.remoteMethodCtx('userAcl', {
Self.remoteMethod('userAcl', {
description: 'Get all of the current user permissions',
accepts: {
arg: 'roles',
type: 'any',
type: ['string'],
required: true,
},
returns: {
@ -17,6 +17,6 @@ module.exports = Self => {
});
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/validate-token')(Self);
require('../methods/vn-user/privileges')(Self);
require('../methods/vn-user/user-acl')(Self);
// Validations

View File

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