Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
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);
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.
7.1.1 and problem reproduced in 7.2.1 as well. The template is produced on the Platform via Composer ide.
Orhan
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.
That is weird. Tried it with 7.3.0-b51 and still getting the error..
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
There is already a case for this: PTC Case C13364695 opened a few months back..
Orhan Dengiz thanks for highlighting this I'll check with the case owner for this.
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.