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;
|
||||
|
||||
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);
|
||||
|
||||
if (!hasRole)
|
||||
|
|
|
@ -70,7 +70,7 @@ describe('VnUser privileges()', () => {
|
|||
const tx = await models.VnUser.beginTransaction({});
|
||||
|
||||
const options = {transaction: tx};
|
||||
const agency = await models.Role.findOne({
|
||||
const agency = await models.VnRole.findOne({
|
||||
where: {
|
||||
name: 'agency'
|
||||
}
|
||||
|
|
|
@ -239,7 +239,7 @@ module.exports = Self => {
|
|||
|
||||
// Prepare data
|
||||
|
||||
let roles = await $.Role.find({
|
||||
let roles = await $.VnRole.find({
|
||||
fields: ['id', 'name', 'description']
|
||||
});
|
||||
let roleRoles = await $.RoleRole.find({
|
||||
|
|
|
@ -102,7 +102,7 @@ describe('sale canEdit()', () => {
|
|||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const role = await models.Role.findOne({
|
||||
const role = await models.VnRole.findOne({
|
||||
where: {
|
||||
name: roleEnabled.principalId
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ describe('sale canEdit()', () => {
|
|||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const role = await models.Role.findOne({
|
||||
const role = await models.VnRole.findOne({
|
||||
where: {
|
||||
name: roleEnabled.principalId
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server');
|
|||
describe('Worker activeWithInheritedRole', () => {
|
||||
let allRolesCount;
|
||||
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() => {
|
||||
|
|
Loading…
Reference in New Issue