I have to remove all the security privileges' on all buttons etc. because I need to copy the project and give it to a customer. My problem is I have hundreds and hundreds of faceplates and pages so manually going one by one on every single component to see if it has security then remove it is not possible. Is there a way to search for things that have security privilege's on them?
You could write a script to remove security from the window itself by deleting the permissions.json file for each window in the project. This could probably be done for the templates as well. I would test this first and make sure that deleting a permissions.json won't corrupt the window. As for components and other things, you might could write a script the removes or sets security privileges and loop through all comps on a screen, but I'm not sure of a way to do that.
This may be a bit late, but if you have set your security privileges as recommended here, How to enable a component in for a particular user - #3 by PGriffith, it should be just a matter of your customer creating the roles on their system and they're in!
If you have done expression bindings or similar then you'll appreciate the benefits of Component and Window Security by the time you're finished. Sorry.
I didn’t find an intuitive way in the designer to remove security from a group of objects after it had been assigned. Instead I took the group, copied it into a notepad, removed the part that looks like this
<c-c m="putClientProperty" s="2;O;O"> <str>v.per</str> <o cls="com.inductiveautomation.vision.api.client.components.model.security.ComponentPermissions"> <o-c m="setInheritPermissions" s="1;b"><false/></o-c> <o-c m="setRequiredRoles" s="1;[str"><array cls="str" len="0"/></o-c> <o-c m="setRestrictions" s="1;[com.inductiveautomation.vision.api.client.components.model.security.ComponentRestriction"><array cls="com.inductiveautomation.vision.api.client.components.model.security.ComponentRestriction" len="0"/></o-c> </o> </c-c>
and then copied it back into the screen with CTRL + I.
Please see Wiki - how to post code on this forum. You seem to have pasted the lot in as a single line so the word wrap is weird. Or was it all a single line? You can fix it by adding three ``` (backticks) on a line before and after the code block.
Hi Transistor. I did do that initially and it completely cropped what I had. Code blocks don’t like XML I guess.
I really don't like the built in security shield that Ignition offers. Much prefer to just create a custom property called permissive, and use that on all input and button components.
No problem:
<c-c m="putClientProperty" s="2;O;O">
<str>v.per</str>
<o cls="com.inductiveautomation.vision.api.client.components.model.security.ComponentPermissions">
<o-c m="setInheritPermissions" s="1;b">
<false/>
</o-c>
<o-c m="setRequiredRoles" s="1;[str">
<array cls="str" len="0"/>
</o-c>
<o-c m="setRestrictions" s="1;[com.inductiveautomation.vision.api.client.components.model.security.ComponentRestriction">
<array cls="com.inductiveautomation.vision.api.client.components.model.security.ComponentRestriction" len="0"/>
</o-c>
</o>
</c-c>
For posterity, as the XML snippet above alludes, component permissions are stored via Swing's putClientProperty method.
So you could combine a script like this:
With calling the static method on ComponentPermissions:
To get something like this:
from com.inductiveautomation.vision.api.client.components.model.security import ComponentPermissions
def getComponents(window):
def walkComponents(component):
for component in component.components:
yield component
walkComponents(component)
return walkComponents(window.rootContainer)
for path in system.gui.getOpenWindowNames():
win = system.gui.getWindow(path)
for component in getComponents(win):
ComponentPermissions.set(component, None)
You could open a batch of windows in the designer, then execute that script in the script console, then save those windows and open the next batch, to very quickly remove all configured component security in Vision.