c# - Storing different user permissions in databse with customizations -
in custom user permissions, have like:
userid permission 11100001 viewthis 11100001 viewthat 11100002 editthis 11100003 editthat
now, want viewthis
more customized, example target specific cost center, user can view employees cost center(s). added column costcenter
. if it's null
means user can view cost centers. problem other permissions, example viewthat
needs customized well, problem customization or limitation not target cost center, target other factors, example contract type. users permission viewthat
should limited employees contract type. added column contracttypeid
. column should ignored in permissions field not required. permission requires 2 or more of customization/limitation fields.
the problem now, table growing horizontally whenever need add customization/limitation permission. there better way or best practice in dealing such dilemma?
there way normalize out in data model. let me show example:
tables user
, permission
clear, guess. in accessible
store things want restrict access to: costcenter
, contracttype
, ...
from description understand want define specific combinations of accessibles , permissions (viewthis on costcenter, viewthat on contracttype, etc.). can define these combinations in accessiblepermission
.
when you've got these combinations can assign them users in useraccessiblepermission
.
this definition part of authorization.
the enforcement part of authorization should consist of business logic grants all permissions on all accessibles users has no specific permissions. when there specific permission, authorization changes none, except.
this 1 way go this. i'd surprised if matched requirements 100%, hope gives direction.
Comments
Post a Comment