Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

是否会死循环? #6

Closed
xgene opened this issue Aug 11, 2015 · 2 comments
Closed

是否会死循环? #6

xgene opened this issue Aug 11, 2015 · 2 comments

Comments

@xgene
Copy link

xgene commented Aug 11, 2015

我看role添加parent时是没有做检查的,如果包含关系不当,例如: a=>b=>c=>d=>e=>(b) ,那么在使用HasPermission时查找一个不存在的permission,是否会死循环呢? 我没测试过,只是猜测可能会

@mikespook
Copy link
Owner

这个现在来说的确是有可能出现的。有考虑过增加循环依赖的检查,不过由于实现效率和设计形态没有考虑得很好,一直没有实现。主要是希望以一种独立的插件形式增加循环依赖检查机制,这样一方面不破坏现有 API,另一方面,对于不需要检查的用户来说是也不会有额外的效率负担。

mikespook added a commit that referenced this issue Sep 4, 2015
@mikespook
Copy link
Owner

增加了用于检测角色循环继承的函数 InherCircle。由于目的不是找到所有的强连通分量,所以简化了 Tarjan 算法,因此只要存在一个强连通分量就提示错误。由于 Golang 的 map 的无序性,所以对于存在循环的情况下,表现并不十分稳定。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants