政策架构

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   服务 > 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 Chrome 浏览器(iOS 版)

后续步骤