Click here to Skip to main content
14,335,049 members
Rate this:
Please Sign up or sign in to vote.
How to create user rights and Admin rights for windows project?

I have 25 forms in which the user has to insert, update, delete, and view records. How do I give insert rights only to a user and the particular form? Some users have insert and update rights only.
How do I create my database and how do I design my form for this?
Posted
Updated 9-Dec-10 0:02am
v2
Rate this:
Please Sign up or sign in to vote.

Solution 1

Create one User access rights form. There you keep 3 check boxes for add, edit and delete. Then for each user you need to give access for the different forms. Insert this into table. Then the user login, for each form check the access and enable/disable the add/edit/delete buttons.
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 2

It depends on how you will be testing if the user is an Admin or User.

The standard way to do this is to define groups, and then add users into the groups. Your application then tests to see if the user is a member of a group, and allow\deny access to resources accordingly.

http://msdn.microsoft.com/en-us/library/5k850zwb.aspx[^]

If you are using Windows authentication with Active Directory, you can define your AD groups and just use WindowsPrincipal objects to test for group member ship.

WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent());
bool result = wp.IsInRole(@"domain\Role");


You can also use any other database that has the ability to store group \ user information and create your own principal objects

I wrote an article on using AspNetDb (usually used for Asp Net membership information) with WinForms

WinForms - Using a custom principal with AspNetDb[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100