更改應用訪問許可權設置

information

本頁面使用機器翻譯而成。
機器翻譯免責聲明 (External link)

目錄

更改應用訪問許可權設置

更改應用的訪問設置。

URL

在生產環境中更新應用時,URL 與在測試環境中更新應用時不同。

如果要在正式版中更新應用

運行此 API 時,測試環境中應用的所有設置都會反映在生產應用中,而不僅僅是應用許可權。

常規應用
https://sample.cybozu.com/k/v1/app/acl.json
建立訪客空間
https://sample.cybozu.com/k/guest/GUEST_SPACE_ID/v1/app/acl.json
如果要在測試環境中更新應用
常規應用
https://sample.cybozu.com/k/v1/preview/app/acl.json
建立訪客空間
https://sample.cybozu.com/k/guest/GUEST_SPACE_ID/v1/preview/app/acl.json

HTTP 方法

PUT

所需許可權

  • 應用程式管理

請求

參數

如果設置了以下許可權,則還必須允許相關許可權。

  • 如果允許「編輯記錄」或「刪除記錄」 則還必須允許「查看記錄」。
  • 如果允許「導入檔」 則還必須允許「添加記錄」。
參數名稱 必須 說明
app 數位或字串 必須 應用ID
rights 陣列 必須 存取權限清單
按優先順序排序。
即使您為"所有人"指定了優先順序,與其他設置相比,它的優先順序也是最低的。
rights[].entity 物件 必須 設置許可權的內容
rights[].entity.type 字串 必須 訪問許可權的類型
  • USER:使用者
  • GROUP:群組
  • ORGANIZATION:組織
  • CREATOR:建立應用程式
rights[].entity.code 字串 條件必填項 要為其設置許可權的代碼

entity.type 這取決於的值。
  • 對於"使用者":用戶的登錄名
  • 對於"GROUP":組代碼
  • 對於"ORGANIZATION":組織代碼
  • "CREATOR":不需要規範。
如果未指定「everyone」,則不允許對 Everyone 進行所有操作。
如果要指定來賓使用者,請在登錄名前加上"guest/"。
rights[].includeSubs 布爾值或字串 自選 設置是否由子單位繼承
  • true:繼承時
  • false:不繼承
entity.type 僅當在 中指定了"ORGANIZATION"時才有效。
如果省略,則設置"false"。
rights[].appEditable 布爾值或字串 自選 是否可以管理應用
  • true:允許應用管理
  • false:不允許應用程式管理
如果省略,則設置"false"。
rights[].recordViewable 布爾值或字串 自選 是否可以查看記錄
  • true:允許查看
  • false:不允許查看
如果省略,則設置"false"。
rights[].recordAddable 布爾值或字串 自選 是否可以添加記錄
  • true:允許添加記錄
  • false:不允許添加
如果省略,則設置"false"。
rights[].recordEditable 布爾值或字串 自選 是否可以編輯記錄
  • true:允許編輯
  • false:不允許編輯
如果省略,則設置"false"。
rights[].recordDeletable 布爾值或字串 自選 是否可以刪除記錄
  • true:允許刪除
  • false:不允許刪除
如果省略,則設置"false"。
rights[].recordImportable 布爾值或字串 自選 檔是否可以讀取
  • true:允許讀取檔
  • false:不允許讀取檔
如果省略,則設置"false"。
rights[].recordExportable 布爾值或字串 自選 檔是否可以匯出
  • true:允許檔案匯出
  • false:不允許檔匯出
如果省略,則設置"false"。
revision 數位或字串 自選 預期修訂號
如果與實際修訂號不匹配,則會發生錯誤,並且不會更改設置。
如果指定值"-1"或未指定值,則不會驗證修訂號。
示例請求
頁眉
1
2
3
4
{
  "X-Cybozu-API-Token": "API_TOKEN",
  "Content-Type": "application/json"
}

關於請求頭,請參見 kintone REST API的通用規範

身體
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
  "app": 1,
  "rights": [
    {
      "entity": {
        "type": "USER",
        "code": "user1"
      },
      "appEditable": true,
      "recordViewable": true,
      "recordAddable": true,
      "recordEditable": true,
      "recordDeletable": true,
      "recordImportable": true,
      "recordExportable": true
    },
    {
      "entity": {
        "type": "GROUP",
        "code": "group1"
      },
      "appEditable": false,
      "recordViewable": false,
      "recordAddable": false,
      "recordEditable": false,
      "recordDeletable": false,
      "recordImportable": false,
      "recordExportable": false
    },
    {
      "entity": {
        "type": "ORGANIZATION",
        "code": "org1"
      },
      "includeSubs": true,
      "appEditable": false,
      "recordViewable": true,
      "recordAddable": true,
      "recordEditable": true,
      "recordDeletable": true,
      "recordImportable": true,
      "recordExportable": true
    },
    {
      "entity": {
        "type": "CREATOR"
      },
      "appEditable": true,
      "recordViewable": true,
      "recordAddable": true,
      "recordEditable": true,
      "recordDeletable": true,
      "recordImportable": true,
      "recordExportable": true
    }
  ],
  "revision": 2
}

回應

財產
屬性名稱 說明
revision 字串 更改應用設置后的修訂號
示例回應
1
2
3
{
  "revision": "3"
}

示例代碼

使用 curl 的請求
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
curl -X PUT 'https://sample.cybozu.com/k/v1/app/acl.json' \
  -H 'X-Cybozu-API-Token: API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "app": 1,
    "rights" [
      {
        "entity": {
          "type": "USER",
          "code": "user1"
        },
        "appEditable": true,
        "recordViewable": true,
        "recordAddable": true,
        "recordEditable": true,
        "recordDeletable": true,
        "recordImportable": true,
        "recordExportable": true
      }, {
        "entity": {
          "type": "GROUP",
          "code": "everyone"
        },
        "includeSubs": true,
        "appEditable": true,
        "recordViewable": true,
        "recordAddable": true,
        "recordEditable": true,
        "recordDeletable": true,
        "recordImportable": false,
        "recordExportable": false
      }, {
        "entity": {
          "type": "CREATOR"
        },
        "appEditable": true,
        "recordViewable": true,
        "recordAddable": true,
        "recordEditable": true,
        "recordDeletable": true,
        "recordImportable": true,
        "recordExportable": true
      }
    ]
  }'
發送kintone REST API請求 使用API 發送請求
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const body = {
  app: kintone.app.getId(),
  rights: [
    {
      entity: {
        type: 'USER',
        code: 'user1'
      },
      appEditable: true,
      recordViewable: true,
      recordAddable: true,
      recordEditable: true,
      recordDeletable: true,
      recordImportable: true,
      recordExportable: true
    }, {
      entity: {
        type: 'GROUP',
        code: 'everyone'
      },
      includeSubs: true,
      appEditable: true,
      recordViewable: true,
      recordAddable: true,
      recordEditable: true,
      recordDeletable: true,
      recordImportable: false,
      recordExportable: false
    }, {
      entity: {
        type: 'CREATOR'
      },
      appEditable: true,
      recordViewable: true,
      recordAddable: true,
      recordEditable: true,
      recordDeletable: true,
      recordImportable: true,
      recordExportable: true
    }
  ]
};
await kintone.api(kintone.api.url('/k/v1/app/acl.json', true), 'PUT', body);