03-23-2011 10:38 AM
Hi Gang,
We're developing an application in LV 2010 where we need to control user access to parts of the application. This application will be installed on about 50 machines. Out IT dept can assign users to one or more of three special groups to manage permissions through Windows. I need to be able to read what groups the current user belongs to programmatically from LabVIEW. I know it can be done from Teststand, but we're not using that.
I know how to get the username from the application object, but then we'd have to manage our own list of privileges on the network somewhere and we don't want to do that.
I saw here in DevZone that somebody posted a DLL which return a boolean if the user is an administrator, and that is tantalizingly close, but doesn't do it.
I hope we don't need to dig into Windows system programming to do this. It seems that somebody would've done this before.
All help appreciated!
Roger
Solved! Go to Solution.
03-23-2011 01:23 PM
While I'm sure it has been done before by people, accessing the Windows domain user and group rights management is a rather underdocumented area and very complex. We have done in the past a similar setup for a client using the SA-Admin ActiveX component from SoftArtisan, but a quick check shows that they do not sell that product anymore. Even with that ActiveX component it was a very complicated thing to do. Trying to do that with direct Windows API calls is definitely a major project of its own.
In a nutshell, if you can avouid this at all in any way I would certainly go for that option. It's going to be a pain in the ass to develop no matter what, and the additional benefit for 50 machines is really small.
03-23-2011 02:53 PM
Willing to deal with a .NET solution? The attached assumes you're in an Active Directory environment. NOTE: This requires .NET 3.5.
03-24-2011 08:24 AM
Hi!
I tried your code. I must admit, I don't fully understand it yet. And It generates an error at the end...
...But, it Works!
Thank You!
Roger
03-24-2011 09:15 AM
I have to admit I actually adapted the code from a posting I saw on a forum dealing with .NET. So, to understand it you'd have to look at the documentation for the classes that it's using.
What was the error that it generates?
03-24-2011 09:28 AM
Hi,
The error happens when the MoveNext property goes false, the Current and Name properties are (apparently) at the end of list and generate errors. What I've done is to put them into a case structure so they only get called when MoveNext is true.
Roger
03-24-2011 09:36 AM
Ah, yes. That one. The original code didn't have the error clusters wired. I wired them up and forgot that the MoveNext will generate an error at the end.
05-11-2017 07:15 AM
If this is still active would appreciate someone sending me this..code..not familiar nor used dot net.
Or reading material or both.
Thanks..
05-11-2017 07:26 AM
05-11-2017 07:39 AM
yup sorry...didn't see the attachment until I posted. I'll give the reading a try and the vi
Sorry..and thxs