code: function getThingUserRights(userId, username, thing) {
  
  	if (!userId && !username)
  		throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "userId or usernane must be not empty", 28);
  	if (!thing)
  		throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "Thing can't be null", 27);
  
  	let thingUserRights = null;
  
  	if (userId)
  		thingUserRights = thing.usersRights.find(u => u.userId == userId);
  	if (!thingUserRights && username)
  		thingUserRights = thing.usersRights.find(u => u.username == username);
  	
  	return thingUserRights;
  }
docs: First search is by userId after it searchs by username Can return null