Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hello!
I've developed a java extension for a resource whose services will be called within my thingworx platform.
Is there a way to hardcode-set the 'Service Execute' RunTime permissions on this extension's services, inside the .java file itself?
The idea is to have the permissions defined in the extension itself, otherwise, the Resources' collective permissions will be automatically assigned to my custom resource.
I've consulted the Extension Development Guide , but I could not find out how to do so.
I imagine, such parameterization is to be set on the tag '@ThingworxServiceDefinition ' in the java code
E.G.: @ThingworxServiceDefinition(name = "GenerateBillingDetailsReport", description = "Generate a pdf file with the Billing Details Report", category = "", isAllowOverride = false, aspects = {
"isAsync:false" })
Thank you!
Solved! Go to Solution.
So, I've received a response elsewere, which worked fine, and I'll re-post that answer here:
You can add permissions in the metadata.xml file of your extension. In the following example i'm giving ServiceInvoke permissions to all members of the Users group (every user in the platform):
```
<Resource className="com.thingworx.extensions.myresource" description="Tomcat utilities" name="MyResource">
<JarResources>
<FileResource type="JAR" file="resource-extension.jar" description="Test"/>
</JarResources>
<RunTimePermissions>
<Permissions resourceName="*">
<ServiceInvoke>
<Principal isPermitted="true" principalName="Users" type="Group"/>
</ServiceInvoke>
</Permissions>
</RunTimePermissions>
</Resource>
```
The easiest way to figure out the syntax for this permissions is to create a Thing, create permissions on it and then export it as XML.
So, I've received a response elsewere, which worked fine, and I'll re-post that answer here:
You can add permissions in the metadata.xml file of your extension. In the following example i'm giving ServiceInvoke permissions to all members of the Users group (every user in the platform):
```
<Resource className="com.thingworx.extensions.myresource" description="Tomcat utilities" name="MyResource">
<JarResources>
<FileResource type="JAR" file="resource-extension.jar" description="Test"/>
</JarResources>
<RunTimePermissions>
<Permissions resourceName="*">
<ServiceInvoke>
<Principal isPermitted="true" principalName="Users" type="Group"/>
</ServiceInvoke>
</Permissions>
</RunTimePermissions>
</Resource>
```
The easiest way to figure out the syntax for this permissions is to create a Thing, create permissions on it and then export it as XML.