refs #4074 vn-user refactored
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
4479a47b7b
commit
827fc7bacd
|
@ -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]);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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] || {};
|
||||||
|
|
Loading…
Reference in New Issue