06-28-2010 09:57 PM
I've searched in several ways for this information and have been unsuccessful. Is there a way to add entries to the NI_UserCustomPrivileges container--and save the changes to disk, of course? I've found many examples of adding and deleting users and changing their privileges, but I haven't been able to find a way to add new privilege variables.
Thanks for your help!
Solved! Go to Solution.
06-30-2010 08:29 AM
Hi strimble,
Assume we create two local variables, an array of Object References called "typeFileArray", and a Number called "typeIndex". Then, the following should allow you to create the type of variable you are interested in.
Locals.typeFileArray =
RunState.Engine.GetTypeUsageLocations("NI_UserCustomPrivileges"),
Locals.typeIndex = Locals.typeFileArray[0].AsPropertyObjectFile.TypeUsageList
.GetTypeIndex("NI_UserCustomPrivileges"),
Locals.typeFileArray[0].AsPropertyObjectFile.TypeUsageList
.GetTypeDefinition(Locals.typeIndex).SetValBoolean("HelloJohn", 1, True),
Locals.typeFileArray[0].AsPropertyObjectFile.IncChangeCount(),
Locals.typeFileArray[0].AsPropertyObjectFile.SaveFileIfModified(True)
I hope this helps!
John M
06-30-2010 09:44 AM
Thanks, John. This works perfectly. I didn't realize it would be so simple. Thanks for your help!