cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

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

vinesh
8-Gravel

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

5 REPLIES 5
posipova
20-Turquoise
(To: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

posipova
20-Turquoise
(To:Constantine)

Sorry didn't notice. Was replying to unattended threads

Sorry.. I had posted that in another forum..Could not delete it,,, If possible could you please delete it?

Top Tags