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

源代码普通用户增加超级管理员权限不生效 #16

Open
yang59324 opened this issue May 10, 2019 · 0 comments
Open

源代码普通用户增加超级管理员权限不生效 #16

yang59324 opened this issue May 10, 2019 · 0 comments

Comments

@yang59324
Copy link

yang59324 commented May 10, 2019

源代码普通用户增加超级管理员权限不生效,排查了一下代码,发现代码逻辑上如果用户A注册后默认为普通用户,增加超级管理员后,有两个role,但是在判断权限的时候,普通用户的role排在前面,当匹配到普通用户,循环语句break,无法继续循环到其他role的查询。
此处应该把break改成continue,保证高低权限同时存在的时候,能循环到最高级权限。
if result["tag"] == role_dict["superuser"]: # 100 放到最后以保证系统管理在最后 menu = [1, 10, 11, 12, 2, 20, 21, 22, 3, 30, 4, 40, 5, 50, 6, 60, 61, 62, 63, 7, 70, 8, 80, 100, 101, 102, 103, 104 ] break elif result["tag"] == role_dict["product"]: menu = [1, 10, 11, 12, 2, 20, 21, 22, 3, 30, 4, 40, 5, 50, 6, 60, 61, 62, 63 ] continue ##源代码为break elif result["tag"] == role_dict["common_user"]: menu = [1, 10, 11, 12, 2, 20, 21, 22, 5, 50, 6, 60, 61, 62, 63 ] continue ##源代码为break

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

1 participant