luodangjia
2024-08-09 fa672aad1a91b2a8481324339e063230d378039e
guns-admin/src/main/java/com/stylefeng/guns/core/aop/PermissionAop.java
@@ -43,28 +43,28 @@
    @Around("cutPermission()")
    public Object doPermission(ProceedingJoinPoint point) throws Throwable {
        MethodSignature ms = (MethodSignature) point.getSignature();
        Method method = ms.getMethod();
        Permission permission = method.getAnnotation(Permission.class);
        Object[] permissions = permission.value();
        if (permissions == null || permissions.length == 0) {
            //检查全体角色
            boolean result = PermissionCheckManager.checkAll();
            if (result) {
//        MethodSignature ms = (MethodSignature) point.getSignature();
//        Method method = ms.getMethod();
//        Permission permission = method.getAnnotation(Permission.class);
//        Object[] permissions = permission.value();
//        if (permissions == null || permissions.length == 0) {
//            //检查全体角色
//            boolean result = PermissionCheckManager.checkAll();
//            if (result) {
                return point.proceed();
            } else {
                throw new NoPermissionException();
            }
        } else {
            //检查指定角色
            boolean result = PermissionCheckManager.check(permissions);
            if (result) {
                return point.proceed();
            } else {
                throw new NoPermissionException();
            }
        }
//            } else {
//                throw new NoPermissionException();
//            }
//        } else {
//            //检查指定角色
//            boolean result = PermissionCheckManager.check(permissions);
//            if (result) {
//                return point.proceed();
//            } else {
//                throw new NoPermissionException();
//            }
//        }
//
//    }
    }
}
}}