473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Auto log users in w/ AD credentials?

70 64KB
I'm trying to make it so that users are automatically logged in w/ their credentials from Active Directory. I already have an audit log which tracks the username of the person making changes. I want to do basically the same thing for db logon.

The main purpose for doing this (besides the fact that my boss said he wants it to have some kind of logon form) is to control who can edit the db, and now. I want to allow all my co-workers to edit records, but only a select few to delete or add new records. Although the equipment inventory form is built so that a record can never be deleted, only its status changed.I realize a logon form is not very secure as it is easily bypassed. However I mostly want to ensure that the database doesn't get corrupted from people who are not authorized (and/or don't know what they are doing). As I said, I do have an audit log so I mostly need to make it harder for them to do what they shouldn't do.

So, I have two problems. First I need to create a logon form which will log users into the db using their active directory username. Then, based on that username, I need to prevent certain users from pressing certain buttons which will ultimately prevent the user from adding or deleting records.

If someone could please point me in the right direction, I'd appreciate it.
Apr 5 '16 #1
4 1029
NeoPa
32,556 Expert Mod 16PB
You're making it far too hard for yourself.

The user's already logged in, so doing it again in your database is both unnecessary and pointless. All you need is to determine which account is currently logged on. See Function to Return UserName (NT Login) of Current User for help with that.

Once you have that information you can simply check the value in the code when determining which accounts get to do what stuff. Sometimes you can disable (or hide) buttons before they're clicked. At others check the account after it's clicked and take the appropriate action.
Apr 5 '16 #2
ittechguy
70 64KB
Thanks for the help! That does make it a lot easier.

I've added that function. Now I assume I need to call it from another control on the form. For test purposes, I've created a button and tried to call it in the OnClick property by typing Call GetUserName(). It is not working, I believe I am not including the correct arguments.

For now, if I could just get a msgBox that displays my username, that would be a good start.
Apr 5 '16 #3
ittechguy
70 64KB
I figured it out! I needed to call sys_OrigUserID and not GetUserName.

Thanks again for your help.
Apr 5 '16 #4
NeoPa
32,556 Expert Mod 16PB
You're quite right. GetUserName() is what is used within sys_OrigUserID() and is an OS function, so not designed for use with VB or VBA except without some fiddling, as you'll see when you look at the code in sys_OrigUserID() which handles all that for you.
Apr 5 '16 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Gamze | last post by:
Hi, I have difficulties about authentication & authorization thing. My project has an admin folder (which can only be accessed by administrator) and a secret folder - (can be accessed by...
2
by: Bill Struve | last post by:
Need: Auto-logon to a terminal server, start a program, and, when the user is quits the program, auto-logoff. Done so far: Able to use a fixed username/password in a C# program using AxMSTSCLib...
7
by: Steve Drake | last post by:
All, I am doing a WEBDAV request and I want to pass the users Credentials to the webdav server, eg some code like : Request.Credentials = CredentialCache.DefaultCredentials; This does not...
4
by: Jamie | last post by:
I'm trying to create a HttpWebRequest object that uses the current logged in users credentials. The site is using Windows Authentication, Anonymous access is turned off. Will the HttpWebRequest...
5
by: cdlipfert | last post by:
Our intranet is running under windows integrated security. We have domain users that want to access our intranet site via ssl vpn. SSL VPN can not authenticate against services that run under...
3
by: Bil Simser [MVP] | last post by:
Hi guys, I wanted to ask some experts here on a problem someone presented to me. Given a client that's calling a web service (using default credentials) the web service gets invoked fine with...
1
by: Steve.Goodman | last post by:
Appologies if this has already been asked, but after scanning the web and this news group I could find no decent solution. We have a windows App that calls a webservice, using this bit of basic...
3
by: Dmitry | last post by:
I am trying to figure out how to pass set of credentials to System.IO Challenge is: App is running under one set of credentials, but via GUI user have a chance to enter another set. I would like...
1
by: Arpan | last post by:
Suppose a web.config file (existing in C:\Inetpub\wwwroot\ASPX) has the following code: <configuration> <system.web> <authentication mode="Forms"> <forms name="AuthenticateUser"...
2
Frinavale
by: Frinavale | last post by:
Hello Everyone, Currently my VB.NET project has two aspx pages that store strings containing my email server access credentials. I'd like to change this somehow so that these credentials are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.