Chrome 政策會由 Schema Service API 以「政策結構定義」表示。 每個政策結構定義都有專屬名稱,用於識別設定、設定欄位及其類型的定義,以及使用者可理解的設定英文說明。
舉例來說,結構定義 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
是其專屬 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 |
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
是由應用程式類型和應用程式 ID 結合而成。例如:
chrome:mkaakpdehdafacodkgkpghoibnmamcme
代表「Google 繪圖」Chrome 應用程式android:com.google.android.calendar
代表「Google 日曆」Android 應用程式web:https://canvas.apps.chrome
代表「畫布」網頁應用程式
多重值欄位
具有 LABEL_REPEATED
標籤的欄位代表多值欄位,例如清單或陣列。您可以為這些欄位指定多個值。詳情請參閱程式碼範例。
政策結構定義狀態
每項政策都有 policyApiLifecycle
物件來代表目前狀態。這個物件包含下列欄位,其中包含有關政策狀態的詳細資料:
policyApiLifecycleStage
欄位顯示下表的哪個階段最能說明政策的目前狀態。description
欄位會顯示這項政策目前的狀態詳細資料。endSupport
欄位會顯示政策的最終支援日期 (如有定義)。- 只有在 policyApiLifecycleStage 為 API_DEPRECATED 時,才能設定
deprecatedInFavorOf
。其中顯示目前政策淘汰後改用的完整命名空間。 scheduledToDeprecatePolicies
欄位對應至已淘汰的 InFavorOf。其中會顯示因這項政策推出而即將淘汰的舊政策的完整命名空間。
生命週期階段
階段 | 說明 |
---|---|
API_UNSPECIFIED |
政策的目前狀態不明。預留,請勿使用。 |
API_PREVIEW |
政策尚未生效。這個階段可以轉移至 API_CURRENT 或 API_DEVELOPMENT 。 |
API_DEVELOPMENT |
政策尚未定案,因此可能會推出破壞性變更。這個階段可以轉移至 API_CURRENT 或 API_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 瀏覽器 |