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

数据权限 #38

Closed
zilo555 opened this issue Apr 21, 2020 · 3 comments
Closed

数据权限 #38

zilo555 opened this issue Apr 21, 2020 · 3 comments

Comments

@zilo555
Copy link

zilo555 commented Apr 21, 2020

设计:区域以行政区划代码如37,3713,3723,371312,371322,根据区域划分数据权限,在用户表用扩展字段Ext4录入区域代码,通过该字段来取业务表中的相应区域的数据。
问题:1.没有地方能够添加 数据权限的值,自带的userId是在ControllerBaseX中添加的, HttpContext.Items["userId"] = user.ID; 自己定义的区域代码变量不知道在哪加。
2.数据权限能否设置成 StartWith,这样上级可以看下级,同级只能看自己, like '37%'能看3713、3723、371312、371322;而like '3713%'只能看3713、371312、371322这样

@nnhy
Copy link
Member

nnhy commented Apr 21, 2020

写一个 MyEntityController 继承自 EntityController,里面重载OnActionExecuting设置地区,然后自己的控制器继承自 MyEntityController

@zilo555
Copy link
Author

zilo555 commented Apr 21, 2020

石头大佬威武

- public override void OnActionExecuting(Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext filterContext)
-         {
-             var user = ManageProvider.User;
-             HttpContext.Items["userId"] = user.ID;
-             base.OnActionExecuting(filterContext);
-         }

@nnhy
Copy link
Member

nnhy commented Apr 21, 2020

天有多高,心有多大,敢闯敢想!

@nnhy nnhy closed this as completed Jan 20, 2021
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