I basically want to reproduce the read/write tag permissions setup panel in the tag browser, as I want to create a tool to simplify setting of multiple tags' (within multiple UDT instances) write permissions at once (in the absence of being able to apply security levels at the folder level )
After some research I think your best bet is trying to figure out how to expose the export security levels feature on the gateway to the webserver, which exports them in json format. Unfortunately, however, you are gonna need someone way smarter than I am to figure out how to do that. Good luck.
It should be possible, but it's likely something I'll need to get from the gateway context, which is always super painful to work out how to work with as it's mostly undocumented
This is awesome! I have a follow up question. I am just really starting to use gateway scripts like in this case and I am not sure the best way to go about it. As of now I was about to use a gateway Event scheduled script and then figure out a way to put it into a csv file. Am I approaching this in the most efficient way?
For more context. Can i put the results into a component on the designers or is it better t launch a session then put the data on that component in the session?
Edit: I created a library script(i will post it below), then made a view that will use that script and put the result in a component in a session.
Issue:
Here is where I am at but i get an error on getting the configs. I know I am supposed to pass a string but i can not find what that is. project name? gateway name? etc.
Edit2 conclusion: Could not get it to work. ChatGPT4 only makes it more confusing. Will juts manually do this until i hear some feed back.
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 3, in runAction File "", line 5, in getGatewaySecurityLevels TypeError: getSecurityLevelsConfig(): expected 1 args; got 0
at org.python.core.Py.TypeError(Py.java:234)
at org.python.core.PyReflectedFunction.throwError(PyReflectedFunction.java:213)
at org.python.core.PyReflectedFunction.throwArgCountError(PyReflectedFunction.java:266)
at org.python.core.PyReflectedFunction.throwError(PyReflectedFunction.java:323)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:171)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:208)
at org.python.core.PyObject.__call__(PyObject.java:446)
at org.python.core.PyObject.__call__(PyObject.java:450)
at org.python.pycode._pyx3051.getGatewaySecurityLevels$1(:19)
at org.python.pycode._pyx3051.call_function()
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:119)
at org.python.core.PyFunction.__call__(PyFunction.java:406)
at org.python.pycode._pyx3050.runAction$1(:3)
at org.python.pycode._pyx3050.call_function()
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:306)
at org.python.core.PyFunction.function___call__(PyFunction.java:474)
at org.python.core.PyFunction.__call__(PyFunction.java:469)
at org.python.core.PyFunction.__call__(PyFunction.java:464)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:847)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:829)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runFunction(ProjectScriptLifecycle.java:868)
at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(ScriptManager.java:1010)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(ProjectScriptLifecycle.java:950)
at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:161)
at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:98)
at com.inductiveautomation.perspective.gateway.action.ScriptAction.runAction(ScriptAction.java:80)
at com.inductiveautomation.perspective.gateway.action.ActionDecorator.runAction(ActionDecorator.java:18)
at com.inductiveautomation.perspective.gateway.action.SecuredAction.runAction(SecuredAction.java:44)
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.lambda$call$0(ActionCollection.java:263)
at com.inductiveautomation.perspective.gateway.api.LoggingContext.mdc(LoggingContext.java:54)
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.call(ActionCollection.java:252)
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.call(ActionCollection.java:221)
at com.inductiveautomation.perspective.gateway.threading.BlockingTaskQueue$TaskWrapper.run(BlockingTaskQueue.java:154)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at com.inductiveautomation.perspective.gateway.threading.BlockingWork$BlockingWorkRunnable.run(BlockingWork.java:58)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.python.core.PyException: TypeError: getSecurityLevelsConfig(): expected 1 args; got 0
gc = system.util.getContext() # this comes from Paul's Ignition Extensions module. otherwise, you'll need to get the context yourself (search the forum)
sm = gc.getSecurityLevelManager()
return sm.getSecurityLevelsConfig()
Note you can only call this from a gateway scope (Perspective script is simplest way for testing)