cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Extension Development - setting Runtime permissions for your extension's services

SOLVED
Highlighted

Extension Development - setting Runtime permissions for your extension's services

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Extension Development - setting Runtime permissions for your extension's services

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.

View solution in original post

1 REPLY 1
Highlighted

Re: Extension Development - setting Runtime permissions for your extension's services

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.

View solution in original post

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!