Visibility issue upon newly adding a user to a user group that has visibility to a thing
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

