政策結構定義

Chrome 政策會以 Schema Service API 表示的政策結構定義。 每個政策結構定義都有不重複的識別名稱、設定欄位及其類型定義,以及人類可讀的英文設定說明。

舉例來說,以下結構定義 Service API 代表允許登出按鈕在 Chrome 系統匣中顯示的設定。這項設定的簡化表示法為 bool showLogoutButtonInTray。點選下方的「顯示範例」,即可查看結構定義 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 是其專屬 ID,格式如下:{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 是由結合應用程式類型和應用程式 ID 組成的。例如:

  • chrome:mkaakpdehdafacodkgkpghoibnmamcme 代表「Google 繪圖」Chrome 應用程式
  • android:com.google.android.calendar 代表「Google 日曆」Android 應用程式
  • web:https://canvas.apps.chrome 代表「Canvas」網頁應用程式

多值欄位

具有 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 瀏覽器

後續步驟