c# - Role based Authentication using action name -


i working on c# mvc project entity framework. trying role based authentication.

i have 3 tables roles, permissionfunction , permission.

roles :

roleid | rolename  -------------------  1     | admin      2     | super admin  3     | user 

permission function

pfid | functionname  -------------------------  1   | usercreate          2   | useredit        3   | userdelete          4   | userview                5   | productcreate           6   | productedit         7   | productdelete           8   | productview 

permision

permisionid | roleid| pfid -------------------------  1          | 1     | 1  2          | 1     | 2  3          | 1     | 3  4          | 1     | 4  5          | 3     | 5  6          | 3     | 6 

these sample datas.

i need check role of user when logins , according give access permissible pages.

i have view admin can change permission details.

enter image description here

the functionname in permission function table string, , need use give or stop access corresponding action.

i searched , found nothing, new type of stuff, please suggest me better way achieve this.

thanks in advance.

 public override void onactionexecuting(actionexecutingcontext filtercontext) 

you can override on action executeing , check permision on method(eg: user credentials).based on pemission can return flag method true or false.

more information


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -