デフォルトのロールとフィルターを作成する 非推奨

POST /groups/{groupId}/apps/{appId}/services/{serviceId}/default_rule

データソースのデフォルトのロールとフィルターを作成します。

path パラメータ

application/ JSON

body 必須

デフォルト ルール設定オブジェクト。

  • 役割 array[オブジェクト]

    デフォルトのユーザーロールの順序付き一覧。

    ロール属性を非表示にする ロール属性の表示 オブジェクト
    • document_filters オブジェクト
      document_filters 属性を非表示 document_filters 属性の表示 オブジェクト
      • 読み取り

        次の 1 つ:

        A rule expression that evaluates to true if the role can read the document.

        A rule expression that evaluates to true if the role can read the document.

      • 書込み (write)

        次の 1 つ:

        A rule expression that evaluates to true if the role can write to the document.

        A rule expression that evaluates to true if the role can write to the document.

    • name string

      ロールの名前。

    • apply_when

      次の 1 つ:

      A rule expression that evaluates to true when this role applies to a user for a specific document.

      A rule expression that evaluates to true when this role applies to a user for a specific document.

    • 読み取り

      次の 1 つ:

      A rule expression that evaluates to true if the role has permission to read all fields in the document. If Device Sync is enabled, use document_filters.read instead.

      A rule expression that evaluates to true if the role has permission to read all fields in the document. If Device Sync is enabled, use document_filters.read instead.

    • 書込み (write)

      次の 1 つ:

      A rule expression that evaluates to true if the role has permission to add, modify, or remove all fields in the document. If Device Sync is enabled, use document_filters.write instead.

      A rule expression that evaluates to true if the role has permission to add, modify, or remove all fields in the document. If Device Sync is enabled, use document_filters.write instead.

    • insert

      次の 1 つ:

      A rule expression that evaluates to true if the role has permission to insert a new document into the collection.

      A rule expression that evaluates to true if the role has permission to insert a new document into the collection.

    • 削除

      次の 1 つ:

      A rule expression that evaluates to true if the role has permission to delete a document from the collection.

      A rule expression that evaluates to true if the role has permission to delete a document from the collection.

    • フィールド オブジェクト

      Field-level rules for any fields that are not explicitly configured in the role's properties.

    • additional_fields オブジェクト

      Field-level rules for any fields that are not explicitly configured in the role's properties.

      additional_fields 属性を非表示にする additional_fields 属性を表示 オブジェクト
      • 読み取り

        次の 1 つ:

        A rule expression that evaluates to true if the role can read the field's value.

        A rule expression that evaluates to true if the role can read the field's value.

      • 書込み (write)

        次の 1 つ:

        A rule expression that evaluates to true if the role can write the field's value.

        A rule expression that evaluates to true if the role can write the field's value.

  • フィルター array[オブジェクト]

    デフォルトのクエリフィルターの一覧。

    フィルター属性を非表示 フィルター属性の表示 オブジェクト

    受信したクエリ操作を実行する前に条件付きで変更するフィルター。

    • name string

      フィルターの名前。

    • apply_when

      次の 1 つ:

      A rule expression that evaluates to true if the filter applies to an incoming query.

      A rule expression that evaluates to true if the filter applies to an incoming query.

    • クエリ オブジェクト

      操作が実行される前に受信クエリにマージされるMongoDBクエリオブジェクト。

    • プロジェクション オブジェクト

      操作が実行される前に受信クエリにマージされるMongoDBプロジェクションオブジェクト。

      プロジェクション属性を非表示 プロジェクション属性の表示 オブジェクト
      • * 数値 additionalProperties

        値は 0 または 1 です。

応答

  • 201 application/ JSON

    デフォルト ルールを作成しました。

    応答属性の非表示 応答属性の表示 オブジェクト
    • _id string

      デフォルト ルールのユニークな ObjectId 識別子。

    • 役割 array[オブジェクト]

      デフォルトのユーザーロールの順序付き一覧。

      Hide roles attributes Show roles attributes オブジェクト
      • _id string

        ロールの一意の ObjectId 識別子。

      • document_filters オブジェクト
        document_filters 属性を非表示 document_filters 属性の表示 オブジェクト
        • 読み取り

          次の 1 つ:

          A rule expression that evaluates to true if the role can read the document.

          A rule expression that evaluates to true if the role can read the document.

        • 書込み (write)

          次の 1 つ:

          A rule expression that evaluates to true if the role can write to the document.

          A rule expression that evaluates to true if the role can write to the document.

      • name string

        ロールの名前。

      • apply_when

        次の 1 つ:

        A rule expression that evaluates to true when this role applies to a user for a specific document.

        A rule expression that evaluates to true when this role applies to a user for a specific document.

      • 読み取り

        次の 1 つ:

        A rule expression that evaluates to true if the role has permission to read all fields in the document. If Device Sync is enabled, use document_filters.read instead.

        A rule expression that evaluates to true if the role has permission to read all fields in the document. If Device Sync is enabled, use document_filters.read instead.

      • 書込み (write)

        次の 1 つ:

        A rule expression that evaluates to true if the role has permission to add, modify, or remove all fields in the document. If Device Sync is enabled, use document_filters.write instead.

        A rule expression that evaluates to true if the role has permission to add, modify, or remove all fields in the document. If Device Sync is enabled, use document_filters.write instead.

      • insert

        次の 1 つ:

        A rule expression that evaluates to true if the role has permission to insert a new document into the collection.

        A rule expression that evaluates to true if the role has permission to insert a new document into the collection.

      • 削除

        次の 1 つ:

        A rule expression that evaluates to true if the role has permission to delete a document from the collection.

        A rule expression that evaluates to true if the role has permission to delete a document from the collection.

      • フィールド オブジェクト

        Field-level rules for any fields that are not explicitly configured in the role's properties.

      • additional_fields オブジェクト

        Field-level rules for any fields that are not explicitly configured in the role's properties.

        additional_fields 属性を非表示にする additional_fields 属性を表示 オブジェクト
        • 読み取り

          次の 1 つ:

          A rule expression that evaluates to true if the role can read the field's value.

          A rule expression that evaluates to true if the role can read the field's value.

        • 書込み (write)

          次の 1 つ:

          A rule expression that evaluates to true if the role can write the field's value.

          A rule expression that evaluates to true if the role can write the field's value.

    • フィルター array[オブジェクト]

      デフォルトのクエリフィルターの一覧。

      Hide filters attributes Show filters attributes オブジェクト
      • _id string

        フィルターの一意の ObjectId 識別子。

      • name string

        フィルターの名前。

      • apply_when

        次の 1 つ:

        A rule expression that evaluates to true if the filter applies to an incoming query.

        A rule expression that evaluates to true if the filter applies to an incoming query.

      • クエリ オブジェクト

        A MongoDB query object that is merged into an incoming query before the operation runs.

      • プロジェクション オブジェクト

        A MongoDB projection object that is merged into an incoming query before the operation runs.

        プロジェクション属性を非表示 プロジェクション属性の表示 オブジェクト
        • * 数値 additionalProperties

          値は 0 または 1 です。

  • 400 application/ JSON

    デフォルト ルールはすでに存在します。

    応答属性を非表示 応答属性の表示 オブジェクト
    • エラー string

      値は default rule already exists です。

POST /groups/{groupId}/apps/{appId}/services/{serviceId}/default_rule
curl \
 --request POST 'https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/services/{serviceId}/default_rule' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{
  "roles": [
    {
      "document_filters": {},
      "name": "string",
      "fields": {},
      "additional_fields": {}
    }
  ],
  "filters": [
    {
      "name": "string",
      "query": {},
      "projection": {
        "additionalProperty1": 0,
        "additionalProperty2": 0
      }
    }
  ]
}'
リクエスト例
{
  "roles": [
    {
      "document_filters": {},
      "name": "string",
      "fields": {},
      "additional_fields": {}
    }
  ],
  "filters": [
    {
      "name": "string",
      "query": {},
      "projection": {
        "additionalProperty1": 0,
        "additionalProperty2": 0
      }
    }
  ]
}
応答の例(201)
{
  "_id": "string",
  "roles": [
    {
      "_id": "string",
      "document_filters": {},
      "name": "string",
      "fields": {},
      "additional_fields": {}
    }
  ],
  "filters": [
    {
      "_id": "string",
      "name": "string",
      "query": {},
      "projection": {
        "additionalProperty1": 0,
        "additionalProperty2": 0
      }
    }
  ]
}
応答の例(400)
{
  "error": "default rule already exists"
}