一、概述
业务上需要跳过弹窗打开里面的所有按钮权限。
二、代码实践:
实现AuthFilterService权限接口。
java
package pro.shushi.pamirs.top.api.spi;
import org.apache.commons.lang3.StringUtils;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import pro.shushi.pamirs.auth.api.spi.AuthFilterService;
import pro.shushi.pamirs.boot.web.session.AccessResourceInfoSession;
import pro.shushi.pamirs.meta.common.spi.SPI;
@Order(88)
@Component
@SPI.Service
public class CustomAuthFilterService implements AuthFilterService {
public static final String skipPath = "/top_demo/uiMenuc6238c29bca44250a041691565056a63/ACTION#top.Teacher#uiView2b60cc6daa334c7280cb78207d41addc";
@Override
public Boolean isAccessAction(String model, String name) {
String path = AccessResourceInfoSession.getInfo().getOriginPath();
if (StringUtils.isNotEmpty(path) && path.startsWith(skipPath)) {
//返回true就代表通过验证
return true;
}
return null;
}
@Override
public Boolean isAccessAction(String path) {
if (StringUtils.isNotEmpty(path) && path.startsWith(skipPath)) {
//返回true就代表通过验证
return true;
}
return null;
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
可以看到弹窗下面的按钮都不需要权限控制了。 