refs #5666 perf: replace Role by VnRole
This commit is contained in:
parent
2fe631f078
commit
57add7abf0
|
@ -68,7 +68,7 @@ module.exports = Self => {
|
||||||
userToUpdate.hasGrant = hasGrant;
|
userToUpdate.hasGrant = hasGrant;
|
||||||
|
|
||||||
if (roleFk) {
|
if (roleFk) {
|
||||||
const role = await models.Role.findById(roleFk, {fields: ['name']}, myOptions);
|
const role = await models.VnRole.findById(roleFk, {fields: ['name']}, myOptions);
|
||||||
const hasRole = await Self.hasRole(userId, role.name, myOptions);
|
const hasRole = await Self.hasRole(userId, role.name, myOptions);
|
||||||
|
|
||||||
if (!hasRole)
|
if (!hasRole)
|
||||||
|
|
|
@ -70,7 +70,7 @@ describe('VnUser privileges()', () => {
|
||||||
const tx = await models.VnUser.beginTransaction({});
|
const tx = await models.VnUser.beginTransaction({});
|
||||||
|
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const agency = await models.Role.findOne({
|
const agency = await models.VnRole.findOne({
|
||||||
where: {
|
where: {
|
||||||
name: 'agency'
|
name: 'agency'
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,7 +239,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
// Prepare data
|
// Prepare data
|
||||||
|
|
||||||
let roles = await $.Role.find({
|
let roles = await $.VnRole.find({
|
||||||
fields: ['id', 'name', 'description']
|
fields: ['id', 'name', 'description']
|
||||||
});
|
});
|
||||||
let roleRoles = await $.RoleRole.find({
|
let roleRoles = await $.RoleRole.find({
|
||||||
|
|
|
@ -102,7 +102,7 @@ describe('sale canEdit()', () => {
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const role = await models.Role.findOne({
|
const role = await models.VnRole.findOne({
|
||||||
where: {
|
where: {
|
||||||
name: roleEnabled.principalId
|
name: roleEnabled.principalId
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ describe('sale canEdit()', () => {
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const role = await models.Role.findOne({
|
const role = await models.VnRole.findOne({
|
||||||
where: {
|
where: {
|
||||||
name: roleEnabled.principalId
|
name: roleEnabled.principalId
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server');
|
||||||
describe('Worker activeWithInheritedRole', () => {
|
describe('Worker activeWithInheritedRole', () => {
|
||||||
let allRolesCount;
|
let allRolesCount;
|
||||||
beforeAll(async() => {
|
beforeAll(async() => {
|
||||||
allRolesCount = await app.models.Role.count();
|
allRolesCount = await app.models.VnRole.count();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the workers with an inherited role of salesPerson', async() => {
|
it('should return the workers with an inherited role of salesPerson', async() => {
|
||||||
|
|
Loading…
Reference in New Issue