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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Java extension: How to add run-time instance permissions to a service in java

ptc-914827
5-Regular Member

Java extension: How to add run-time instance permissions to a service in java

Hi,

I'm building a Java extension that creates a Thing Template with services, and a Thing Shape with services.

How can I set run-time instance permissions to the Template and Shape in java?

Thanks,

Isaac

3 REPLIES 3
ankigupta
5-Regular Member
(To:ptc-914827)

Hi Isaac Kaliski​,

Per my understanding; you will have to create a Service which you can run in composer to add the requisite permissions.

posipova
20-Turquoise
(To:ptc-914827)

Generally for permissions, set superuser context before and clear after:

thing.AddRunTimePermission("PropertyRead", "*", "myGroup", "Group", true);

          thing.RestartThing();

Note for The Templates, the intent is to grant run time privileges on the instances created from the Template and not on the Template itself. So  AddInstanceRuntimePermissions works and the AddRunTimePermission does not work on template itself. As Templates do not hold the actual values, they are there for just defining the metadata.

ptc-914827
5-Regular Member
(To:ptc-914827)

So what you are saying is that there is no way to add permissions in the extension itself. Only after importing the extension the admin needs to do an extra operation to setup permissions?

If the admin needs to do an extra operation to setup the permissions in the Composer, he might setup the permissions directly rather than running manually a service.

Top Tags