def org_unit_change()

in libs/google/admin.py [0:0]


  def org_unit_change(self, user_key):
    """
    Moves user to offboarded OrgUnit.
    :param user_key: userKey
    :param org_unit_path: orgUnitPath
    :return: bool
    Note: When successful, this request returns None.
    """
    org_unit_path = self.config["offboarded_ou"]
    try:
      r = json.loads(self.call_google_api(service=self.service,
                                          api_resource="users",
                                          api_method="update",
                                          response_field="primaryEmail",
                                          userKey=user_key,
                                          body={"orgUnitPath": org_unit_path}))
      if r == user_key:
        return True
      else:
        return False
    except(ValueError, KeyError, TypeError):
      return False