Skip to content

Commit 5460f8b

Browse files
authored
refactor: 优化接口权限 (#347)
* refactor: 优化接口权限 * refactor: 优化
1 parent 47573d4 commit 5460f8b

File tree

1 file changed

+4
-2
lines changed
  • hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/webflux

1 file changed

+4
-2
lines changed

hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/webflux/WebFluxPermissionController.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.hswebframework.web.api.crud.entity.QueryParamEntity;
1111
import org.hswebframework.web.authorization.Authentication;
1212
import org.hswebframework.web.authorization.annotation.*;
13+
import org.hswebframework.web.authorization.exception.UnAuthorizedException;
1314
import org.hswebframework.web.crud.service.ReactiveCrudService;
1415
import org.hswebframework.web.crud.web.reactive.ReactiveServiceCrudController;
1516
import org.hswebframework.web.system.authorization.api.entity.PermissionEntity;
@@ -59,11 +60,12 @@ public Mono<Integer> changePermissionState(@PathVariable @Parameter(description
5960
}
6061

6162
@GetMapping("/_query/for-grant")
62-
@ResourceAction(id = "grant", name = "赋权")
63-
@QueryNoPagingOperation(summary = "获取用于赋权的权限列表")
63+
@Authorize(ignore = true)
64+
@QueryNoPagingOperation(summary = "获取当前用户用于赋权的权限列表")
6465
public Flux<PermissionEntity> queryForGrant(QueryParamEntity query) {
6566
return Authentication
6667
.currentReactive()
68+
.switchIfEmpty(Mono.error(UnAuthorizedException::new))
6769
.flatMapMany(auth -> permissionProperties
6870
.getFilter()
6971
.doFilter(permissionService.query(query.noPaging()), auth));

0 commit comments

Comments
 (0)