AuthorityRule 设计
- Dominant language
- Java
- Stars
- 23.1k
- Forks
- 8.1k
- PR merge metrics
- No merged PRs in 30d
Description
## Issue Description
Type: *feature request*
问题1:
AuthorityRuleManager 定义 Map> authorityRules = new ConcurrentHashMap<>()
从定义上来讲,resourceName和AuthorityRule是一对多的关系,但是实际加载时:
One resource should only have at most one authority rule, so just ignore redundant rules.
资源和规则是一对一的关系,概念模糊;
问题2:
按照上面的设计resourceName和AuthorityRule是一对一的关系,控制台创建AuthorityRule规则时,应该需要判断当前resourceName是否已经创建过规则;如果创建过,对同一资源创建应该添加失败,而不是客户端将已有的规则和新创建的规则,一起传到客户端,客户端再去加载第一个
Advice:
1.保留Map> authorityRules的设计,resourceName对应多个AuthorityRule
2.新建一个Map,存储resourceName和黑白名单的对应关系,一个resource只允许被设置黑名单或者白名单,如果第一个规则是黑名单,以后的规则必须是黑名单才能加载
3.dashboard需要改造,查询当前resource是否被设置过黑白名单,已经设置过的,判断新增的规则是否匹配当前的黑白名单状态,如果不符合,创建Rule直接报错提示,当前resource已经存在黑名单或者白名单;
总结问题:
1.AuthorityRule可以一对多,不需要在原有规则后面进行修改
2.客户端规则加载更合理
Contributor guide
Research direction
Start by reading AuthorityRuleManager and tracing dashboard rule creation and client rule loading. Compare the current one-to-many declaration with the stated one-rule-per-resource behavior and the proposed blacklist/whitelist constraints. Done means the relationship is unambiguous and duplicate or conflicting rules are handled consistently across creation and loading.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- authorization, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100