1

I'm trying to read a property value of a thing in java extension, I'm always getting the Exception "Not authorized for PropertyRead on ss in PSIM_AlarmManagementServices_Thing"

my code is

Thing AlarmManagementServices_Thing = (Thing) EntityUtilities.findEntityDirect("PSIM_AlarmManagementServices_Thing",
                ThingworxRelationshipTypes.Thing);
        String ss = AlarmManagementServices_Thing.GetStringPropertyValue("ss");

enter image description here

  • Hi, the error message it's quite straightforward, it should be a permisioning problem, the user who it's executing this service has PropertyRead permissions on the given property? – Carles Coll Jan 25 '19 at 14:11
  • Hi Carlos, it is straightforward, but I gave the permissions for all the users in thingworx, but the same problem still, I think the extension runs under the system user, is n't it? I also gave him permission but still the same problem. – Tarik Ziyad Jan 25 '19 at 14:53
  • Hi Tarik, no the extension it's executed on the context of the current user that started the service. Did you try to execute the extension service from the Administrator user? – Carles Coll Jan 28 '19 at 07:52
  • Hi Carlos, I have 4 users in my system: Administrator, admin, system and supeUser, I gave them all the run time and design time permissions from the thing itself, but still the same issue – Tarik Ziyad Jan 28 '19 at 08:24
  • Hi Tarik, you are receiving an error on OverstayMinutesLimit as you say on your text, but the code shared it's referencing "ss" property name, which it's the reason?Do you know that you have to restart tomcat each time you update a Java extension? Can you try to do the exact same code on TW Javascript Server side in order to test the permissions without the "extension layer". – Carles Coll Jan 28 '19 at 08:30
  • Hi Carlos, sorry it was my mistake in naming, I updated the post, yes I'm restarting the tomcat each time the extension is updated, I will test the code from TW itself and update you, thanks – Tarik Ziyad Jan 28 '19 at 08:37
  • Hi Carlos, I can access the property without the extension layer. – Tarik Ziyad Jan 28 '19 at 08:45
  • Hi Carlos, now I know why I had this error, when I'm accessing the thing's property from inside a sub-thread, ı have this error, but if I access it from the main thread of the Resource it goes without errors. Same things I had before when I was trying to call AddDataTableEntry's service of a dataTable from inside a sub-thread, I didn't have an error but the row wasn't added. Thank you very much, Carlos – Tarik Ziyad Jan 28 '19 at 09:18
  • Hi Carlos, if you know the reason behind this behavior please let me know also, Thanks and Regards – Tarik Ziyad Jan 28 '19 at 09:44

1 Answers1

0

now I know why I had this error, when I'm accessing the thing's property from inside a sub-thread, I have this error, but if I access it from the main thread of the Resource it goes without errors. Same things I had before when I was trying to call AddDataTableEntry's service of a dataTable from inside a sub-thread, I didn't have an error but the row wasn't added.