修复刷新权限问题

This commit is contained in:
COOL 2022-05-11 15:00:43 +08:00
parent f9fa1fd5eb
commit 540d93e133
2 changed files with 3 additions and 5 deletions

View File

@ -36,6 +36,7 @@ export default {
// port: 6379, // port: 6379,
// password: '', // password: '',
// db: 1, // db: 1,
// ttl: null,
// }, // },
// }, // },
// cool配置 // cool配置

View File

@ -33,16 +33,13 @@ export class BaseSysPermsService extends BaseService {
async refreshPerms(userId) { async refreshPerms(userId) {
const roleIds = await this.baseSysRoleService.getByUser(userId); const roleIds = await this.baseSysRoleService.getByUser(userId);
const perms = await this.baseSysMenuService.getPerms(roleIds); const perms = await this.baseSysMenuService.getPerms(roleIds);
await this.cacheManager.set(`admin:perms:${userId}`, JSON.stringify(perms)); await this.cacheManager.set(`admin:perms:${userId}`, perms);
// 更新部门权限 // 更新部门权限
const departments = await this.baseSysDepartmentService.getByRoleIds( const departments = await this.baseSysDepartmentService.getByRoleIds(
roleIds, roleIds,
this.ctx.admin.username === 'admin' this.ctx.admin.username === 'admin'
); );
await this.cacheManager.set( await this.cacheManager.set(`admin:department:${userId}`, departments);
`admin:department:${userId}`,
JSON.stringify(departments)
);
} }
/** /**