Skip to main content
10-Marble
November 5, 2025
Solved

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

  • November 5, 2025
  • 1 reply
  • 361 views

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!

Best answer by Bhavya_PC

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.

1 reply

16-Pearl
November 6, 2025

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 😉

Bhavya_PC10-MarbleAuthorAnswer
10-Marble
November 10, 2025

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.