09-09-2016 09:13 AM
Hi,
I would like to create custom User Manager tool in LabVIEW, but I can't get user container. I'm able to get Users array (I have only "administartor" item in Users File), but I'm not able to get subproperties 😞 I'm getting -17306 error in GetNumSubProperties.
I tried with the following code.
How to programmatically copy all Users File to LabVIEW Tree Control? Or at least list all in form of array.
Solved! Go to Solution.
09-09-2016 11:13 AM
First of all I can tell you that it will always be 5 on the NumSubProperties. 🙂
The problem is you are using the name as the lookupString. Pass an empty string and you will see what you want. An empty string will get the number of subProperties of the current PropertyObject, which in this case is the User.
Or you can convert the reference of your GetPropertyObjectByOffset to a User by using a Variant to Data and use a refnum constant set to the TestStand API User. This way you can use the TestStand API for User to get whatever you'd like. I've attached a small example using LabVIEW 2011 and TestStand 2010
09-12-2016 03:49 AM
"First of all I can tell you that it will always be 5 on the NumSubProperties."
So it is not possible to modify User data type?
Thank you for the solution with varinat, it is very elegant IMO. I will use this approach. Other, small but usefull, style convention is changing Close Referece primitives lables so they informs which reference are they closing. I will stick with that also 🙂
09-14-2016 04:00 AM
Jigg I have a question related with your code.
Is User and User Object the same reference? Why do I need to use User Object Close Reference?
09-14-2016 08:53 AM
I don't completely understand it, but basically they are different references. I know that if you don't close both you will get an error message when you exit. At least I did.
I think it has something to do with the Variant To Data node. I believe that it is switching out activex components and therefore creating a different reference.
Sorry I'm not more versed in that.
Regards,
09-14-2016 09:32 AM
Jigg is correct,
VariantToData is getting an interface, which is a separate reference. It's mentioned briefly on page 63 and 64 of Using LabVIEW and LabWindowsTM/CVI with TestStand in the "Obtaining a Different Interface for TestStand Objects" and "Duplicating COM References in LabVIEW Code Modules" sections.
-Trent
12-31-2019 02:59 AM
Can you share your method to get the previliges? i am corious about it! Thank you in advance!
12-31-2019 09:55 AM
@open28 wrote:
Can you share your method to get the previliges? i am corious about it! Thank you in advance!
Do you want to check if the current user has a certain privilege? Then use this method: https://zone.ni.com/reference/en-XX/help/370052AA-01/tsapiref/reftopics/engine_currentuserhasprivile...
Otherwise you can do: User.Privileges which will give you the privilege settings for that user.
Maybe I'm not clear what you are looking for?
01-01-2020 06:30 PM
HI, thank you for your response.
I just now want to design a LABVIEW GUI and just use the TESTSTAND 2014 simple GUI labview source code.
For managing the prevelliges such as operator can not config the setting, I hope i can get the prevellige after login a user, then i can judge the person whether have the prevellige to config ,and gray the setting button.
Now the most important problem is that i don`t know how to get the current user prevellige after the user login. And the methond you said is useful after the Test UUT is running and i just need to use the property to get it.But I want to get the prevellige before the test UUT is running.
Can you share me some other method?
Thank you in advance!
01-02-2020 01:26 PM
Actually you don't need an execution in order to call those methods. As long as you have a reference to the engine (which you should once the application manager calls the Start method), then you should be able to call those methods. I do this all the time in user interfaces.