mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2026-02-18 18:23:49 +00:00
parent
d715483c14
commit
97f9664dd9
@ -34,18 +34,18 @@ export class BaseAuthorityMiddleware implements IWebMiddleware {
|
|||||||
if (_.startsWith(url, adminUrl)) {
|
if (_.startsWith(url, adminUrl)) {
|
||||||
try {
|
try {
|
||||||
ctx.admin = jwt.verify(token, this.coolConfig.jwt.secret);
|
ctx.admin = jwt.verify(token, this.coolConfig.jwt.secret);
|
||||||
// 超管拥有所有权限
|
} catch (err) { }
|
||||||
if (ctx.admin.username == 'admin' && !ctx.admin.isRefresh) {
|
|
||||||
await next();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (err) {}
|
|
||||||
// 不需要登录 无需权限校验
|
// 不需要登录 无需权限校验
|
||||||
if (new RegExp(`^${adminUrl}?.*/open/`).test(url)) {
|
if (new RegExp(`^${adminUrl}?.*/open/`).test(url)) {
|
||||||
await next();
|
await next();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ctx.admin) {
|
if (ctx.admin) {
|
||||||
|
// 超管拥有所有权限
|
||||||
|
if (ctx.admin.username == 'admin' && !ctx.admin.isRefresh) {
|
||||||
|
await next();
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 要登录每个人都有权限的接口
|
// 要登录每个人都有权限的接口
|
||||||
if (new RegExp(`^${adminUrl}?.*/comm/`).test(url)) {
|
if (new RegExp(`^${adminUrl}?.*/comm/`).test(url)) {
|
||||||
await next();
|
await next();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user