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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Is system user required to have its own visibility of things

khayes1
13-Aquamarine

Is system user required to have its own visibility of things

Hi,

does anyone know if the system user needs it's own visibility of things (i.e. adding to organisational units), or does it inherit the visibility permissions of the user calling the wrapping function.

If it does need it's own visibility is there any recommended best practise. I presume that it is not good practise to allow the system user to see everything.

Thanks in advance

K

 

5 REPLIES 5
PaiChung
22-Sapphire I
(To:khayes1)

Not sure if you tested this, but it should NOT need Visibility permissions, it should inherit that from the User invoking.

khayes1
13-Aquamarine
(To:PaiChung)

Okay thank you for that.

 

Not sure what is going on then with a specific issue I have. When I delete customer thing using a custom service I then try and delete the customer's users. However every time I run the service I get the same problem where it says the user [given name] does not exist. This is odd as it got the name  using getmembers() service on the customer's user group  in the line of code prior to trying to delete user. Also if I create a mashup that returns a list of users that the calling user can see (the user doing the deleting) it does list the users I am trying to delete. I thought it must be to do with the system user as it has the rights to create and delete users via the entity services.

 

error is

XXXXX: DeleteCustomerUsers() failed - JavaException: com.thingworx.common.exceptions.InvalidRequestException: User [{name=CS.Admin, description=XXXX user created by ukdistadmin - Fri Jun 22 2018 17:30:54 GMT-0000 (GMT), type=User}] does not exist #13

 

PaiChung
22-Sapphire I
(To:khayes1)

Are Visibility permissions assigned to the Users or are they just in an Organization?

 

khayes1
13-Aquamarine
(To:PaiChung)

The users to be deleted have their own organisational unit set as their visibility permissions

The user doing the deleting is part of an upstream unit (Admin) of the same organisation so the deleting user should be able to see them.

 

khayes1
13-Aquamarine
(To:khayes1)

The code I'm using is:

try
{
     var numDeletedUsers = 0 ;
     //Delete the users from the all user group that should suffice
     var members = Groups[me.AllUsersTeamName].GetGroupMembers();
     var numUsers = members.rows.length ;
    for(x=0 ; x<numUsers ; x++)
    {
          var userName = members.rows[x] ;
          // delete user
          var userParams = {name: userName /* USERNAME */};
          Resources["EntityServices"].DeleteUser(userParams); // no return
          numDeletedUsers++ ;
     }

     logger.info(me.name+": DeleteCustomerUsers() deleted "+numDeletedUsers+"/"+numUsers+" users");
}
catch(err)
{
       logger.error(me.name+": DeleteCustomerUsers() failed - "+err+" #"+err.lineNumber);
}

Top Tags