Need to design several ASP.Net Web Forms that change based on User Type and Permission Levels.
There are seven User Types defined in the database (ClientType Table, ID = 0-7).
All Fields in the database that will map back to controls in our Web Forms are also defined by User Type with View/Add/Modify/Delete permissions and stored in a seperate table in the database.
ie
tbl_FieldAccess
FieldName = Client_Name (Client Name Field in our Client Table)
ClientType = 1
View = 1
Add = 0
Modify = 0
Delete = 0
FieldName = Client_Name ClientType = 7
View = 1
Add = 1
Modify = 1
Delete = 1
What is the best way (patterns, practices, specific examples) to now take my actual web form controls and map them to the records in my tbl_FieldAccess table and then use that to determine whether or not to show/hide the control, make it readonly, etc.?
Note: I have to use legacy login and authentication so ASP.Net Membership API is not an option here.
Using ASP.Net, C# and SQL Server.
Thanks!
I’m recommending you to create a view model for your pages:
Then your aspx looks like:
And your code behind: