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

Problem Adding Runtime permissions to a ThingTemplate with JS

orhand
2-Explorer

Problem Adding Runtime permissions to a ThingTemplate with JS

I am trying to add runtime permissions to a thingtemplate via javascript but getting an error. What is the proper way of doing this ?

It works when I use AddInstanceRunTimePermission(params) but gives an error for AddRunTimePermission(params) which is required by the application.

The error I get:

Wrapped java.lang.Exception: This entity does not support property permissions Cause: This entity does not support property permissions

Which is weird because it can be set at the composer IDE.


Thanks,


Orhan



var params = {

  principal: "DemoUsers" /* STRING */,

  allow: true /* BOOLEAN */,

  resource: "*" /* STRING */,

  type: "PropertyRead" /* STRING */,

  principalType: "Group" /* STRING */

};

// no return

ThingTemplates["TestThingTemplate_Demo"].AddRunTimePermission(params);

9 REPLIES 9
ttielebein
14-Alexandrite
(To:orhand)

What version of ThingWorx is this? There does not appear to be a syntax error. I want to see if I can reproduce this. Is the Thing Template defined in an extension or on the Platform?

I was able to reproduce this on thingworx 7.2.3 B-48

I also verified I can view the permissions using a service, but I can't change them.  I see the same error as posted above.

orhand
2-Explorer
(To:ttielebein)

7.1.1 and problem reproduced in 7.2.1 as well. The template is produced on the Platform via Composer ide.

Orhan

ttielebein
14-Alexandrite
(To:orhand)

I just ran the above Javascript successfully in version 7.2.4. I tried for both a group and an individual user, and on a thing template defined on the platform and via extension. It worked in all cases.

orhand
2-Explorer
(To:ttielebein)

That is weird. Tried it with 7.3.0-b51 and still getting the error..

supandey
19-Tanzanite
(To:orhand)

Orhan, could you please submit a Technical support case for this I can reproduce this on 7.3.1 -b39. Let me know if you don't have access to the support.ptc.com

orhand
2-Explorer
(To:supandey)

There is already a case for this: PTC Case C13364695 opened a few months back..

supandey
19-Tanzanite
(To:orhand)

Orhan Dengiz​ thanks for highlighting this I'll check with the case owner for this.

supandey
19-Tanzanite
(To:supandey)

To update this thread there was Jira filed TW-18533 related to the case number mentioned in this thread. R&D has mentioned that this is likely working to specification for the reason it appears that the intent is to grant run time privileges on the instances created from the Template and not on the Template itself. That is why AddInstanceRuntimePermissions works and not the AddRunTimePermission on template itself. As Templates do not hold the actual values, they are there for just defining the metadata.

Announcements


Top Tags