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

ThingWorx Navigate is now Windchill Navigate Learn More

Translate the entire conversation x

EventExecute permissions of an entity is not able to set through service

Bhavya_PC
10-Marble

EventExecute permissions of an entity is not able to set through service

Hi All,

 

I am trying to apply runtime permissions through a service. The code snippet was working fine in one environment, but when I import the same service in another environment, the permissions are not applying. Specially, all other permissions apply except for EventExecute.

 

Here is the shared working code snippet:


Working code:

json = ThingTemplates["BasePlatform"].GetInstanceRunTimePermissionsAsJSON();
json["permissions"].push({
"PropertyRead": [{
"isPermitted": true,
"name": userGroup,
"type": "Group"
}],
"PropertyWrite": [{
"isPermitted": false,
"name": userGroup,
"type": "Group"
}],
"ServiceInvoke": [{
"isPermitted": true,
"name": userGroup,
"type": "Group"
}],
"EventExecute": [{
"isPermitted": false,
"name": userGroup,
"type": "Group"
}],
"EventSubscribe": [{
"isPermitted": false,
"name": userGroup,
"type": "Group"
}],
"resourceName": "*"
});
 
ThingTemplates["BasePlatform"].SetInstanceRunTimePermissionsAsJSON({
permissions: json /* JSON */
});


Could anyone suggest why the EventExecute permissions specifically might be failing to apply after the environment transfer? Are there any prerequisite settings for event permissions that might be missing in the environment?

Thanks in advance for the help!

ACCEPTED SOLUTION

Accepted Solutions

Hi @nmutter ,

 

Thank you for response. I found the root cause: the EventExcecute Permissions were failing due to a change in json key of the GetInstanceRunTimePermissionsAsJSON() service. It seems the key name has changed from EventExecute to EventInvoke.

 

Since we have not initiated any platform upgrade, we are quite surprised by this change. If you happen to know anything about this change/upgrade, please share it with us so we can understand what caused this modification.

View solution in original post

2 REPLIES 2

Not sure. I would assume that the entity already has EventExecute permissions and the JSON object you create by just pushing new element may be 'wrong' in the end? You would need to check expected json object for the as JSON call (I do not know it tbh).

 

But I would recommend using the "normal" service to set permissions (as they manage the json magic for you in the background ;))

ThingTemplates["BasePlatform"].AddInstanceRunTimePermission({
	principal: userGroup /* STRING */,
	allow: false /* BOOLEAN */,
	resource: "*" /* STRING */,
	type: "EventExecute" /* STRING */,
	principalType: "Group" /* STRING */
});

 Setting ALL permissions via the json seems to scary for me

Hi @nmutter ,

 

Thank you for response. I found the root cause: the EventExcecute Permissions were failing due to a change in json key of the GetInstanceRunTimePermissionsAsJSON() service. It seems the key name has changed from EventExecute to EventInvoke.

 

Since we have not initiated any platform upgrade, we are quite surprised by this change. If you happen to know anything about this change/upgrade, please share it with us so we can understand what caused this modification.

Announcements


Top Tags