优化代码

This commit is contained in:
none
2023-03-24 15:03:17 +08:00
parent 639f3065a2
commit de6a9718f4
11 changed files with 16 additions and 16 deletions

View File

@@ -71,7 +71,7 @@ public class AdminMiddleware implements HandlerInterceptor {
return responseTransform(response, 403, "当前管理员禁止登录");
}
BCtx.setAdminUserId(payload.getSub());
BCtx.setId(payload.getSub());
BCtx.setAdminUser(adminUser);
BCtx.setAdminPer(backendBus.adminUserPermissions(adminUser.getId()));

View File

@@ -35,7 +35,7 @@ public class BackendPermissionMiddlewareImpl {
public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
BackendPermissionMiddleware middleware = signature.getMethod().getAnnotation(BackendPermissionMiddleware.class);
Integer adminUserId = BCtx.getAdminUserID();
Integer adminUserId = BCtx.getId();
HashMap<String, Boolean> permissions = backendBus.adminUserPermissions(adminUserId);
if (permissions.get(middleware.slug()) == null) {
return JsonResponse.error("权限不足", 403);