政策架构

Chrome 政策由 Schema Service API 表示为政策架构。 每个政策架构都具有用于标识它的唯一名称、设置字段及其类型的定义,以及简单易懂的设置说明(英文)。

例如,Schema Service API 如何表示允许在 Chrome 系统任务栏中显示退出按钮的设置。此设置的简化表示形式为 bool showLogoutButtonInTray。如需了解 Schema Service API 如何表示此设置,请点击下方的“显示示例”。

显示示例

{
  "name": "customers/C0202nabg/policySchemas/chrome.users.ShowLogoutButton",
  "policyDescription": "Show logout button in tray.", // description of the policy
  "definition": { // definition of the settings (fields names and types)
    "messageType": [
      {
        "name": "ShowLogoutButton",
        "field": [
          {
            "name": "showLogoutButtonInTray", // the setting showLogoutButtonInTray
            "number": 1,
            "label": "LABEL_OPTIONAL",
            "type": "TYPE_BOOL" // the setting showLogoutButtonInTray is of type boolean
          }
        ]
      }
    ]
  },
  "fieldDescriptions": [ // human readable descriptions of the settings and their values
    {
      "field": "showLogoutButtonInTray",
      "knownValueDescriptions": [
        {
          "value": "true",
          "description": "Show logout button in tray." // description for showLogoutButtonInTray=true
        },
        {
          "value": "false",
          "description": "Do not show logout button in tray." // description for showLogoutButtonInTray=false
        }
      ]
    }
  ],
  "schemaName": "chrome.users.ShowLogoutButton" //  unique name to identify the policy
}
  

政策架构名称

架构的 name 是其唯一标识符,格式如下:{namespace}.{leafName}

在上面的示例中,完整的架构名称为 chrome.users.ShowLogoutButton。命名空间为 chrome.users.,叶名称为 ShowLogoutButton

范围相似的政策会划分到同一命名空间。例如,所有用户政策架构均以 chrome.users. 命名空间为前缀,而所有打印机政策架构均以 chrome.printers. 命名空间为前缀。

命名空间

命名空间 所需的管理员角色权限
chrome.users.LEAF_NAME   服务 > Chrome 管理 > 设置 > 管理用户设置
chrome.users.apps.LEAF_NAME key="app_id" 服务 > Chrome 管理 > 设置 > 管理用户设置 > 管理应用设置
chrome.users.appsconfig.LEAF_NAME   服务 > Chrome 管理 > 设置 > 管理用户设置 > 管理应用设置
chrome.devices.LEAF_NAME   服务 > Chrome 管理 > 设置 > 管理 ChromeOS 设备设置
chrome.devices.managedguest.LEAF_NAME   服务 > Chrome 管理 > 设置 > 管理 ChromeOS 设备设置
chrome.devices.managedguest.apps.LEAF_NAME key="app_id" 服务 > Chrome 管理 > 设置 > 管理 ChromeOS 设备设置
chrome.devices.kiosk.LEAF_NAME   服务 > Chrome 管理 > 设置 > 管理 ChromeOS 设备设置
chrome.devices.kiosk.apps.LEAF_NAME key="app_id" 服务 > Chrome 管理 > 设置 > 管理 ChromeOS 设备设置
chrome.devices.kiosk.appsconfig.LEAF_NAME key="app_id" 服务 > Chrome 管理 > 设置 > 管理 ChromeOS 设备设置
chrome.printers.LEAF_NAME key="printer_id" 服务 > Chrome 管理 > 设置 > 管理打印机
chrome.printservers.LEAF_NAME key="print_server_id" 服务 > Chrome 管理 > 设置 > 管理打印机
chrome.networks.globalsettings.LEAF_NAME   服务 > 共享设备设置
chrome.networks.wifi.LEAF_NAME key="network_id" 服务 > 共享设备设置
chrome.networks.ethernet.LEAF_NAME key="network_id" 服务 > 共享设备设置
chrome.networks.vpn.LEAF_NAME key="network_id" 服务 > 共享设备设置
chrome.networks.certificates.LEAF_NAME key="network_id" 服务 > 共享设备设置

政策架构键

某些政策需要额外的背景信息才能查看或修改。例如:

  • 如需修改应用的政策,您需要填充 key="app_id" 以指定哪个应用。
  • 如需修改组织部门中的打印机设置政策,您需要通过填充 key="printer_id" 来指定哪种打印机。

这些政策架构包含一个 additionalTargetKeyNames 部分,描述要在 API 请求中传递的键和值。

如需了解详情,请参阅代码示例

显示示例

{
  "name": "customers/C0202nabg/policySchemas/chrome.printers.AllowForUsers",
  "policyDescription": "Allows a printer for users in a given organization.",
  "additionalTargetKeyNames": [
    {
      "key": "printer_id",
      "keyDescription": "Id of printer as visible in Admin SDK printers API."
    }
  ],
  "definition": {
    "messageType": [
      {
        "name": "AllowForUsers",
        "field": [
          {
            "name": "allowForUsers",
            "number": 1,
            "label": "LABEL_OPTIONAL",
            "type": "TYPE_BOOL"
          }
        ]
      }
    ]
  },
  "fieldDescriptions": [
    {
      "field": "allowForUsers",
      "description": "Controls whether a printer is allowed for users in a given organization."
    }
  ],
  "schemaName": "chrome.printers.AllowForUsers"
}
  

应用政策

上述某些命名空间适用于应用政策,例如用户应用、自助服务终端应用、受管理的访客会话应用和自助服务终端应用配置政策。应用政策要求提供 app_id

app_id 由应用类型和应用标识符组成。例如:

  • chrome:mkaakpdehdafacodkgkpghoibnmamcme 表示“Google 绘图”Chrome 应用
  • android:com.google.android.calendar 表示“Google 日历”Android 应用
  • web:https://canvas.apps.chrome 表示“画布”Web 应用

多值字段

带有 LABEL_REPEATED 标签的字段表示多值字段,例如列表或数组。您可以为这些字段指定多个值。如需了解详情,请参阅代码示例

政策架构状态

每项政策都有一个 policyApiLifecycle 对象来表示其当前状态。此对象包含以下字段,其中包含有关政策状态的详细信息:

  • policyApiLifecycleStage 字段显示下表中的哪些阶段最能准确描述政策的当前状态。
  • description 字段详细说明了此政策的当前状态。
  • endSupport 字段会显示政策的最终支持日期(如果已定义)。
  • 仅当 policyApiLifecycleStage 为 API_DEPRECATED 时,才能设置 deprecatedInFavorOf。它会显示当前政策已被弃用的新政策的完全限定命名空间。
  • scheduledToDeprecatePolicies 字段对应于已弃用的 InFavorOf。该页面显示了将因引入此政策而弃用的旧政策的完全限定命名空间。

生命周期阶段

阶段 说明
API_UNSPECIFIED 政策的当前状态未知。已保留,请勿使用。
API_PREVIEW 政策尚未生效。此阶段可以转移到 API_CURRENTAPI_DEVELOPMENT
API_DEVELOPMENT 政策尚未最终确定,我们可能会引入破坏性更改。此阶段可以转移到 API_CURRENTAPI_DEPRECATED
API_CURRENT 政策采用官方格式,但可能会引入非重大更改。此阶段可以转移到API_DEPRECATED
API_DEPRECATED 此政策已被弃用,日后可能会被移除。管理员应停止使用此政策。

显示示例

{
  "name": "customers/C0202nabg/policySchemas/chrome.users.OutdatedPolicy",
  "policyDescription": "Just for demo, this is an outdated policy.",
  "definition": {
    "messageType": [
      {
        "name": "OutdatedPolicy",
        "field": [
          {
            "name": "outdatedField",
            "number": 1,
            "label": "LABEL_OPTIONAL",
            "type": "TYPE_BOOL"
          }
        ]
      }
    ]
  },
  "fieldDescriptions": [
    {
      "field": "outdatedField",
      "description": "This is an outdated field"
    }
  ],
  "schemaName": "chrome.users.OutdatedPolicy",
  "policyApiLifecycle": { // policy's current lifecycle status
    "policyApiLifecycleStage": "API_DEPRECATED",
    "description": "This policy is deprecated. Please stop using it",
    "endSupport": {
      "year": 2021,
      "month": 2,
      "day": 29
    }
    "deprecatedInFavorOf": "chrome.users.NewPolicy"
  }
}

{
  "name": "customers/C0202nabg/policySchemas/chrome.users.NewPolicy",
  "policyDescription": "Just for demo, this is a new policy.",
  "definition": {
    "messageType": [
      {
        "name": "NewPolicy",
        "field": [
          {
            "name": "newField",
            "number": 1,
            "label": "LABEL_OPTIONAL",
            "type": "TYPE_BOOL"
          }
        ]
      }
    ]
  },
  "fieldDescriptions": [
    {
      "field": "newField",
      "description": "This is an new field"
    }
  ],
  "schemaName": "chrome.users.NewPolicy",
  "policyApiLifecycle": { // policy's current lifecycle status
    "policyApiLifecycleStage": "API_CURRENT,
    "scheduledToDeprecatePolicies": "chrome.users.OutdatedPolicy"
  }
}
  

政策架构声明

某些政策与 notices 相关联,并且针对特定政策字段的某些值将 acknowledgement_required 设置为 true。对于这些政策,您需要先将一个特殊确认字段设置为 true,然后才能设置值。

如需了解详情,请参阅代码示例

支持的平台

supportedPlatforms 是一个列表,表示政策将仅适用于这些平台上的设备或用户。下表列出了所有支持的平台。

支持的平台

平台 说明
PLATFORM_UNSPECIFIED 未指定平台。已保留,请勿使用。
CHROME_OS ChromeOS
CHROME_BROWSER macOS/Windows/Linux 版 Chrome 浏览器
CHROME_BROWSER_FOR_ANDROID Android 版 Chrome 浏览器
CHROME_BROWSER_FOR_IOS iOS 版 Chrome 浏览器

后续步骤