Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
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
Not sure if you tested this, but it should NOT need Visibility permissions, it should inherit that from the User invoking.
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
Are Visibility permissions assigned to the Users or are they just in an Organization?
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.
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);
}