使用自定义字段将用户列出为非管理员用户

时间:2020-07-07 14:24:57

标签: google-admin-sdk

根据the documentation,只要模式中的字段在ALL_DOMAIN_USERS属性中具有值readAccessType,我就应该能够获得具有自定义模式的用户列表。 。这是我在管理控制台中所做的确切设置;此外,当我对相关架构的schema get endpoint执行get请求时,我得到确认,ALL_DOMAIN_USERS属性中的架构字段已设置为readAccessType

问题是,当我执行users list request时,响应中没有得到自定义模式。请求如下:

GET /admin/directory/v1/users?customer=my_customer&projection=full&query=franc&viewType=domain_public 
HTTP/1.1
Host: www.googleapis.com
Content-length: 0
Authorization: Bearer fakeTokena0AfH6SMD6jF2DwJbgiDZ

我得到的答复如下:

{
  "nextPageToken": "tokenData", 
  "kind": "admin#directory#users", 
  "etag": "etagData", 
  "users": [
    {
      "externalIds": [
        {
          "type": "organization", 
          "value": "value"
        }
      ], 
      "organizations": [
        {
          "department": "department", 
          "customType": "", 
          "name": "Name", 
          "title": "Title"
        }
      ], 
      "kind": "admin#directory#user", 
      "name": {
        "fullName": "Full Name", 
        "givenName": "Full", 
        "familyName": "Name"
      }, 
      "phones": [
        {
          "type": "work", 
          "value": "(999)999-9999"
        }
      ], 
      "thumbnailPhotoUrl": "https://photolinkurl", 
      "primaryEmail": "user@domain.com", 
      "relations": [
        {
          "type": "manager", 
          "value": "user@domain.com"
        }
      ], 
      "emails": [
        {
          "primary": true, 
          "address": "user@domain.com"
        }
      ], 
      "etag": "etagData", 
      "thumbnailPhotoEtag": "photoEtagData", 
      "id": "xxxxxxxxxxxxxxxxxx", 
      "addresses": [
        {
          "locality": "Locality", 
          "region": "XX", 
          "formatted": "999 Some St Some State 99999", 
          "primary": true, 
          "streetAddress": "999 Some St", 
          "postalCode": "99999", 
          "type": "work"
        }
      ]
    }
  ]
}

但是,如果我与超级管理员用户执行相同的请求,则会在响应中获得一个额外的属性:

  "customSchemas": {
    "Dir": {
      "fieldOne": false,
      "fieldTwo": "value",
      "fieldThree": value
    }
  }

我的理解是,只要将自定义架构字段设置为对所有域用户可见,我就应该以非管理员用户身份获得自定义架构。这没有发生。我用G Suite开了一张支持票,但是提供“支持”的人将这个方向发送给我。我相信这是一个错误,或者我忽略了一些东西。

1 个答案:

答案 0 :(得分:0)

我联系了G Suite支持,实际上,此问题是特定于域的问题。

Google的支持工程师花了几周的时间解决了这个问题,但终于解决了。该行为现在是预期的行为。