mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-25 20:35:35 +08:00
优化代码
This commit is contained in:
@@ -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()));
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user