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: 

Different user access level for the program in runtime.

Hello, 

 

I'm trying to add the user control level to the program that inherent to me. So, what i'm trying to do is to have an administrator( with the option to choose to write to database or not) and an operator(with no rights to change anything and always writes result to database).

I have couple of ideas to do it but would like to see if there are better options to do that or labview has something built in for run time or installer for user check. My ideas are as follow:

 

1- Add to the Teststand sequence and check for the user login information(my problem is that i'm trying to avoid TestStand as much as i can because it needs another license for the target machine)

2- Add another state to the program or vi to check for the user and password information( As the program is inherent to me it make take me some time to modify)

Please let me know if there are better solutions for my problem.

 

Thanks

0 Kudos
Message 1 of 5
(2,153 Views)

Have you looked into the Domain Account Manager?

 

https://zone.ni.com/reference/en-XX/help/371361R-01/lvhowto/create_user/

0 Kudos
Message 2 of 5
(2,097 Views)

Thanks @BerMcMahan for your reply.

 

I took a look at that and it seems to set access to the PC or network connection and get the information of the users from there. but i only need two users Administrator and operator so i don't need to do the domain configuration(please correct me if I'm wrong).

What i need is when the application is run it asks for the User name and password and depending on that provided the options. 

I created the .ini file and add operator and administrator with the password for them. is there a way i can feed that to the Labview when creating application or installer of the software?

 

Thansk,

0 Kudos
Message 3 of 5
(2,089 Views)

If you are already able to use the ini file (in e.g. the development environment) to get the behaviour you want, then all that remains for the application or installer is to ensure the file can be packaged alongside the application and that the path is correctly calculated.

 

Note that if you don't encrypt the file somehow, a user only has to open it with notepad to find the Admin password... that may or may not be a problem for you.

 

A perhaps simpler solution in the case that you're sure you have compile-time determined passwords and users is to drop the ini file entirely and create a separate VI (subVI) which accepts two strings (or whatever) and outputs an enum with access level ({Admin, User}) and use that in your code later.

 

The advantage to this is that you could set the application builder to remove the block diagram during the build step, which makes it a little harder to find the password (or maybe even impossible).

The disadvantage is to change the available user names or passwords, you'd have to recompile the application...

If the compile time is long, but in principle there isn't a problem with recompiling (parts) to change the available users, you could also use a PPL to determine the user rights (i.e. put the subVI in a library, build as a PPL, then call that <my auth library>.lvlibp:CheckAccess.vi instead of just CheckAccess.vi or similar).

 

Edit: An example using Maps (from LabVIEW 2019). This is a snippet, so you should be able to download, then drag onto a 2019 block diagram to get the code. I can't backsave it since I used a Map, but you could reproduce it using a different lookup method (e.g. arrays or Variant Attribute tables).

Example_VI.png


GCentral
0 Kudos
Message 4 of 5
(2,061 Views)

You might find this useful.

"If you weren't supposed to push it, it wouldn't be a button."
Message 5 of 5
(2,010 Views)