مانیفست برای مناطق ذخیره سازی

برخلاف مناطق ذخیره‌سازی local و sync ، فضای ذخیره‌سازی managed نیاز دارد که ساختار آن به‌عنوان طرحواره JSON اعلام شود و کاملاً توسط Chrome تأیید شود. این طرح باید در فایلی ذخیره شود که با ویژگی "managed_schema" کلید مانیفست "storage" مشخص شده است و خط‌مشی‌های سازمانی پشتیبانی شده توسط برنامه را اعلام می‌کند.

خط‌مشی‌ها مشابه گزینه‌ها هستند، اما توسط مدیر سیستم به جای کاربر پیکربندی می‌شوند و به برنامه اجازه می‌دهند تا برای همه کاربران یک سازمان از قبل پیکربندی شود. ببینید Chrome چگونه خط‌مشی‌ها را برای نمونه‌هایی از خود Chrome مدیریت می‌کند .

پس از اعلام خط‌مشی‌ها، می‌توان آن‌ها را از Storage.managed API خواند. این به برنامه بستگی دارد که خط‌مشی‌های پیکربندی‌شده توسط سرپرست را اجرا کند.

نمونه manifest.json

ویژگی storage.managed_schema فایلی را در برنامه نشان می‌دهد که حاوی طرح خط‌مشی است.

{
  "name": "My enterprise app",
  "storage": {
    "managed_schema": "schema.json"
  },
  ...
}

سپس Chrome این خط‌مشی‌ها را از سیستم عامل اصلی و از Google Apps برای کاربرانی که به سیستم وارد شده‌اند بارگیری می‌کند. رویداد storage.onChanged هر زمان که تغییر خط‌مشی شناسایی شود فعال می‌شود، از جمله زمانی که مرورگر در حال اجرا نبود اگر برنامه از صفحات رویداد استفاده کند. می‌توانید خط‌مشی‌هایی را که Chrome بارگیری کرده است در chrome://policy تأیید کنید.

قالب طرحواره

قالب JSON Schema دارای برخی الزامات اضافی از Chrome است:

  • طرحواره سطح بالا باید دارای نوع object باشد.
  • object سطح بالا نمی تواند additionalProperties داشته باشد. properties اعلام شده خط مشی های این برنامه هستند.
  • هر طرحواره باید دارای یک مقدار $ref یا دقیقاً یک type باشد.

اگر این طرح نامعتبر باشد، Chrome برنامه افزودنی را بارگیری نمی‌کند و دلیل تأیید نشدن طرح را نشان می‌دهد. اگر مقدار خط مشی با طرح مطابقت نداشته باشد، توسط storage.managed API منتشر نخواهد شد.

طرح واره نمونه

{
  "type": "object",

  // "properties" maps an optional key of this object to its schema. At the
  // top-level object, these keys are the policy names supported.
  "properties": {

    // The policy name "AutoSave" is mapped to its schema, which in this case
    // declares it as a simple boolean value.
    // "title" and "description" are optional and are used to show a
    // user-friendly name and documentation to the administrator.
    "AutoSave": {
      "title": "Automatically save changes.",
      "description": "If set to true then changes will be automatically saved.",
      "type": "boolean"
    },

    // Other simple types supported include "integer", "string" and "number".
    "PollRefreshRate": {
      "type": "integer"
    },

    "DefaultServiceUrl": {
      "type": "string"
    },

    // "array" is a list of items that conform to another schema, described
    // in "items". An example to this schema is [ "one", "two" ].
    "ServiceUrls": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },

    // A more complex example that describes a list of bookmarks. Each bookmark
    // has a "title", and can have a "url" or a list of "children" bookmarks.
    // The "id" attribute is used to name a schema, and other schemas can reuse
    // it using the "$ref" attribute.
    "Bookmarks": {
      "type": "array",
      "id": "ListOfBookmarks",
      "items": {
        "type": "object",
        "properties": {
          "title": { "type": "string" },
          "url": { "type": "string" },
          "children": { "$ref": "ListOfBookmarks" }
        }
      }
    },

    // An "object" can have known properties listed as "properties", and can
    // optionally have "additionalProperties" indicating a schema to apply to
    // keys that aren't found in "properties".
    // This example policy could map a URL to its settings. An example value:
    // {
    //   "youtube.com": {
    //     "blocklisted": true
    //   },
    //   "google.com": {
    //     "bypass_proxy": true
    //   }
    // }
    "SettingsForUrls": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "blocklisted": { "type": "boolean" },
          "bypass_proxy": { "type": "boolean" }
        }
      }
    }
  }
}
،

برخلاف مناطق ذخیره‌سازی local و sync ، فضای ذخیره‌سازی managed نیاز دارد که ساختار آن به‌عنوان طرحواره JSON اعلام شود و کاملاً توسط Chrome تأیید شود. این طرح باید در فایلی ذخیره شود که با ویژگی "managed_schema" کلید مانیفست "storage" مشخص شده است و خط‌مشی‌های سازمانی پشتیبانی شده توسط برنامه را اعلام می‌کند.

خط‌مشی‌ها مشابه گزینه‌ها هستند، اما توسط مدیر سیستم به جای کاربر پیکربندی می‌شوند و به برنامه اجازه می‌دهند تا برای همه کاربران یک سازمان از قبل پیکربندی شود. ببینید Chrome چگونه خط‌مشی‌ها را برای نمونه‌هایی از خود Chrome مدیریت می‌کند .

پس از اعلام خط‌مشی‌ها، می‌توان آن‌ها را از Storage.managed API خواند. این به برنامه بستگی دارد که خط‌مشی‌های پیکربندی‌شده توسط سرپرست را اجرا کند.

نمونه manifest.json

ویژگی storage.managed_schema فایلی را در برنامه نشان می‌دهد که حاوی طرح خط‌مشی است.

{
  "name": "My enterprise app",
  "storage": {
    "managed_schema": "schema.json"
  },
  ...
}

سپس Chrome این خط‌مشی‌ها را از سیستم عامل اصلی و از Google Apps برای کاربرانی که به سیستم وارد شده‌اند بارگیری می‌کند. رویداد storage.onChanged هر زمان که تغییر خط‌مشی شناسایی شود فعال می‌شود، از جمله زمانی که مرورگر در حال اجرا نبود اگر برنامه از صفحات رویداد استفاده کند. می‌توانید خط‌مشی‌هایی را که Chrome بارگیری کرده است در chrome://policy تأیید کنید.

قالب طرحواره

قالب JSON Schema دارای برخی الزامات اضافی از Chrome است:

  • طرحواره سطح بالا باید دارای نوع object باشد.
  • object سطح بالا نمی تواند additionalProperties داشته باشد. properties اعلام شده خط مشی های این برنامه هستند.
  • هر طرحواره باید دارای یک مقدار $ref یا دقیقاً یک type باشد.

اگر این طرح نامعتبر باشد، Chrome برنامه افزودنی را بارگیری نمی‌کند و دلیل تأیید نشدن طرح را نشان می‌دهد. اگر مقدار خط مشی با طرح مطابقت نداشته باشد، توسط storage.managed API منتشر نخواهد شد.

طرح واره نمونه

{
  "type": "object",

  // "properties" maps an optional key of this object to its schema. At the
  // top-level object, these keys are the policy names supported.
  "properties": {

    // The policy name "AutoSave" is mapped to its schema, which in this case
    // declares it as a simple boolean value.
    // "title" and "description" are optional and are used to show a
    // user-friendly name and documentation to the administrator.
    "AutoSave": {
      "title": "Automatically save changes.",
      "description": "If set to true then changes will be automatically saved.",
      "type": "boolean"
    },

    // Other simple types supported include "integer", "string" and "number".
    "PollRefreshRate": {
      "type": "integer"
    },

    "DefaultServiceUrl": {
      "type": "string"
    },

    // "array" is a list of items that conform to another schema, described
    // in "items". An example to this schema is [ "one", "two" ].
    "ServiceUrls": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },

    // A more complex example that describes a list of bookmarks. Each bookmark
    // has a "title", and can have a "url" or a list of "children" bookmarks.
    // The "id" attribute is used to name a schema, and other schemas can reuse
    // it using the "$ref" attribute.
    "Bookmarks": {
      "type": "array",
      "id": "ListOfBookmarks",
      "items": {
        "type": "object",
        "properties": {
          "title": { "type": "string" },
          "url": { "type": "string" },
          "children": { "$ref": "ListOfBookmarks" }
        }
      }
    },

    // An "object" can have known properties listed as "properties", and can
    // optionally have "additionalProperties" indicating a schema to apply to
    // keys that aren't found in "properties".
    // This example policy could map a URL to its settings. An example value:
    // {
    //   "youtube.com": {
    //     "blocklisted": true
    //   },
    //   "google.com": {
    //     "bypass_proxy": true
    //   }
    // }
    "SettingsForUrls": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "blocklisted": { "type": "boolean" },
          "bypass_proxy": { "type": "boolean" }
        }
      }
    }
  }
}