| | |
| | | |
| | | @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(); |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | } |
| | | |
| | | } |
| | | }} |