|
-
Oct 28th, 2003, 04:13 AM
#1
Thread Starter
Lively Member
How to detect a specific user
Hi,
I'm trying to write a vb.net program with an access database (access 2000). The database will be installed on a server and the application itself should be installed on the desktop of every user. The users make all part of the same corporate LAN.
The application will have a number of forms, but not every user should be able to use every function (or form). Is it possible to disable certain menu-functions based on the identification of the user? If yes, is there anybody who can help me with finding code to accomplish this?
Thanks very much
Tom
-
Oct 28th, 2003, 06:21 AM
#2
Frenzied Member
How you authenticate the users of your program (if you do at all)? And what is the basis of their rights?
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Oct 28th, 2003, 07:08 AM
#3
Thread Starter
Lively Member
Well,
I was thinking to create a database with all the usernames and their corresponding rights in it. So if a certain user wants to use the application, I first should have to check his corresponding rights after the application has detected his username.
Or should i use another method?
I dont know if this is possible but I would appreciate if you would give me some hints.
Thanks
Tom
-
Oct 28th, 2003, 07:24 AM
#4
Frenzied Member
Thats a good Idea. You may also apply some methods to strengthen your authentication, for example certain critical tasks maybe done by certain people from special computers in the network.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Oct 28th, 2003, 07:27 AM
#5
Thread Starter
Lively Member
OK, so my idea is good. But I don't know how the write this code. How can an application detect a specific user?
Any code ideas or snippits?
Tom
-
Oct 28th, 2003, 07:47 AM
#6
Frenzied Member
After doin some initializations in your program, you show an authentication form and ask for username and password. Then check the user credentials wih the ones in your database. If the user authenticates show the subsequent forms based on her role. It is wise to store send the passwords encrypted.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Oct 28th, 2003, 09:15 AM
#7
you can get the identity of the user with the " System.Security.Principal namespace " ( WindowsIdenty )
then you could use a Select Case " username " statement, to determine which features to allow the user to have available.
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Oct 28th, 2003, 10:25 AM
#8
Thread Starter
Lively Member
Thanks everybody, problem solved.
This is the working code:
Dim UserIdentity As WindowsIdentity = WindowsIdentity.GetCurrent
'wp = New system.Security.Principal.WindowsPrincipal(WindowsIdentity.GetCurrent())
Me.TextBoxUser.Text = UserIdentity.Name
Many thanks
-
Oct 28th, 2003, 10:51 AM
#9
Alternatively you can use Active Directory for your application security if you want to. You can either attach roles or groups to each user via the name from the code listed OR you can just add the groups/roles directly to the user through AD and then just check for them in your application. You can get a WindowsPrincipal object from the WindowsIdentity object you have and call its IsInRole method to check for roles.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|