From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

get user groups and privileges into labVIEW

Solved!
Go to solution

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

0 Kudos
Message 1 of 10
(4,980 Views)

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.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 10
(4,961 Views)
Solution
Accepted by topic author Roger Montague

Willing to deal with a .NET solution? The attached assumes you're in an Active Directory environment. NOTE: This requires .NET 3.5.

Message 3 of 10
(4,947 Views)

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

0 Kudos
Message 4 of 10
(4,925 Views)

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?

0 Kudos
Message 5 of 10
(4,920 Views)

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

0 Kudos
Message 6 of 10
(4,916 Views)

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.

0 Kudos
Message 7 of 10
(4,911 Views)

If this is still active would appreciate someone sending me this..code..not familiar nor used  dot net.

Or reading material or both.

 

Thanks..

0 Kudos
Message 8 of 10
(4,374 Views)

Hi Clint,

 

what's wrong with the VI posted in the solution of this thread?

 

To learn more about DotNET you should read at MSDN (MicroSoftDeveloperNetwork)!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 10
(4,371 Views)

yup sorry...didn't see the attachment until I posted.  I'll give the reading a try and the vi

Sorry..and thxs

0 Kudos
Message 10 of 10
(4,364 Views)