Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hello,
I am currently trying to implement a service which is executed by a User to move himself to a User Group that has Visibility permissions to a Thing. My Code is as below,
try {
var groupName = "InstrumentUsers" ;
var params_AddMember = {
member: username,
type: "User" /* STRING */
};
Groups[groupName].AddMember(params_AddMember);
}
//respond back with the result
result = {
"success": "true",
"Instrument": {
"Alias": Things["Thing"].Alias, //problem is in this line
"GUID": "xyz"
}
};
} catch (err) {
result = { "success": "false" };
}
The "InstrumentUsers" does have the visibility to the "Thing". I also see that the user is properly moved inside the group. The problem arises when the user tries to execute the line Things["Thing"].Alias where he tries to read the property of the Thing. It says the user does not have visibility permission on the "Thing".
Surprisingly, upon executing the service second time, there is no error. I think the issue is that the Twx takes some time to give permission to a user even if he is the rightful group.
I tried pause(), executing some other service before reading the property etc. nothing works for me.
Regards,
Vinesh
Could you please try breaking the service into two, first create the one that executes up until the line where it breaks, then second to wrap the first one? If that makes sense.
Did that too..Doesn't help
Sorry.. I had posted that in another forum..Could not delete it,,, If possible could you please delete it?