mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2024-11-01 14:10:29 +08:00
忽略字典校验
This commit is contained in:
parent
c2f08e8b7c
commit
9f49777b90
@ -32,13 +32,18 @@ export class BaseAuthorityMiddleware
|
||||
url = url.replace(this.prefix, '');
|
||||
const token = ctx.get('Authorization');
|
||||
const adminUrl = '/admin/';
|
||||
//忽略token验证的url
|
||||
const ignoreUrls = ['/admin/dict/info/data'];
|
||||
// 路由地址为 admin前缀的 需要权限校验
|
||||
if (_.startsWith(url, adminUrl)) {
|
||||
try {
|
||||
ctx.admin = jwt.verify(token, this.jwtConfig.jwt.secret);
|
||||
} catch (err) {}
|
||||
// 不需要登录 无需权限校验
|
||||
if (new RegExp(`^${adminUrl}?.*/open/`).test(url)) {
|
||||
if (
|
||||
new RegExp(`^${adminUrl}?.*/open/`).test(url) ||
|
||||
ignoreUrls.includes(url)
|
||||
) {
|
||||
await next();
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user