Skip to main content
1-Visitor
August 5, 2019
Question

Visibility issue upon newly adding a user to a user group that has visibility to a thing

  • August 5, 2019
  • 5 replies
  • 1885 views

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

5 replies

20-Turquoise
August 6, 2019

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.

vinesh1-VisitorAuthor
1-Visitor
August 7, 2019

Did that too..Doesn't help

20-Turquoise
August 6, 2019
Sorry didn't notice. Was replying to unattended threads