Tombue
asked on
Implementing user roles and permissions in C#
Hi,
I'm woking on a C# database app and I have to implent user roles and permissions. This means that different user can be defined which different roles. A admin has all rights, some users can read/write, others only can read for example.
I think, there are 2 basic methods:
1. Permissions in the SQL Server and handling it in code.
2. Handling completly in code without permissions in the database for a better independence from it.
What is your opinion?
Is there any pattern or code-example to implement user roles and permissions completly in code in C#???
Thank you very much!
Tom
I'm woking on a C# database app and I have to implent user roles and permissions. This means that different user can be defined which different roles. A admin has all rights, some users can read/write, others only can read for example.
I think, there are 2 basic methods:
1. Permissions in the SQL Server and handling it in code.
2. Handling completly in code without permissions in the database for a better independence from it.
What is your opinion?
Is there any pattern or code-example to implement user roles and permissions completly in code in C#???
Thank you very much!
Tom
ASKER
WOW so fast!!!
But I'm working with a Desktop-WinForms-App!?
I did not analyze the sample-code from your answer completly, but works this ASP.NET-Code in my app?
Is there any example for WinForms-Apps?
But I'm working with a Desktop-WinForms-App!?
I did not analyze the sample-code from your answer completly, but works this ASP.NET-Code in my app?
Is there any example for WinForms-Apps?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Needed more explanation
http://msdn.microsoft.com/en-us/library/ff647401.aspx#paght000013_step4
If you need any more help let me know.