refactor: 优化接口权限 (#347)

* refactor: 优化接口权限

* refactor: 优化
This commit is contained in:
gyl
2026-03-26 16:24:15 +08:00
committed by GitHub
parent 47573d460b
commit 5460f8b4d2

View File

@@ -10,6 +10,7 @@ import org.hswebframework.web.api.crud.entity.QueryOperation;
import org.hswebframework.web.api.crud.entity.QueryParamEntity;
import org.hswebframework.web.authorization.Authentication;
import org.hswebframework.web.authorization.annotation.*;
import org.hswebframework.web.authorization.exception.UnAuthorizedException;
import org.hswebframework.web.crud.service.ReactiveCrudService;
import org.hswebframework.web.crud.web.reactive.ReactiveServiceCrudController;
import org.hswebframework.web.system.authorization.api.entity.PermissionEntity;
@@ -59,11 +60,12 @@ public class WebFluxPermissionController implements ReactiveServiceCrudControlle
}
@GetMapping("/_query/for-grant")
@ResourceAction(id = "grant", name = "赋权")
@QueryNoPagingOperation(summary = "获取用于赋权的权限列表")
@Authorize(ignore = true)
@QueryNoPagingOperation(summary = "获取当前用户用于赋权的权限列表")
public Flux<PermissionEntity> queryForGrant(QueryParamEntity query) {
return Authentication
.currentReactive()
.switchIfEmpty(Mono.error(UnAuthorizedException::new))
.flatMapMany(auth -> permissionProperties
.getFilter()
.doFilter(permissionService.query(query.noPaging()), auth));