Help Center/ KooDrive/ API Reference/ API/ Permissions Templates/ Creating a Permissions Template
Updated on 2025-03-14 GMT+08:00

Creating a Permissions Template

Function

Create a permissions template.

URI

POST /koodrive/ose/v1/permission/template/create

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

Authorization

Yes

String

The format is Bearer {app_access_token}. The application-level token needs to be passed for calling by an application server. The token is obtained by calling an API using clientid and clientSecret obtained during application creation.

X-User-Id

Yes

String

User ID, which is used for app authentication.

X-Date

Yes

String

Date, which is used for app authentication.

Host

No

String

Address, which is used for app authentication.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Permissions template name. The value contains up to 24 characters. Letters and digits are allowed.

description

No

String

Permissions template description. The value contains up to 50 characters.

type

Yes

Integer

Permissions template type. 0: preset; 1: custom.

company

Yes

String

Enterprise to which the permissions template belongs. The value can be an organization ID or an application ID.

capabilities

Yes

Capabilities object

Permissions values. The value of ControlService needs to be converted into the decimal value of the final permissions and saved to the database.

Table 3 Capabilities

Parameter

Mandatory

Type

Description

addChildNodePermission

Yes

Boolean

Permission to create a file or folder. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

copyPermission

Yes

Boolean

Copy permission. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

deletePermission

Yes

Boolean

Delete permission. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

downloadPermission

Yes

Boolean

Download permission. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

editPermission

Yes

Boolean

Edit permissions. true: granted; false: not granted (editing is not supported.)

listChildNodePermission

Yes

Boolean

Permission to view the list. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

removeChildNodePermission

Yes

Boolean

Move permission. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

renameFilePermission

Yes

Boolean

Rename permission. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

shareFilePermission

Yes

Boolean

Share permission. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

uploadPermission

Yes

Boolean

Upload permission. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

viewPermission

Yes

Boolean

Preview permission. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

code

Integer

Response code.

msg

String

Response message.

data

PermissionTemplate object

Permissions template information.

Table 5 PermissionTemplate

Parameter

Type

Description

id

String

Unique ID of a permissions template.

name

String

Permissions template name.

description

String

Permissions template description.

templateType

Integer

Permissions template type. 0: preset; 1: custom.

status

Integer

Permissions template status. 0: disabled; 1: enabled.

company

String

Enterprise to which the permissions template belongs. The value can be an organization ID or an application ID.

createTime

String

Time when the permissions template is created.

updateTime

String

Time when the permissions template is updated.

capabilities

Capabilities object

Permissions value.

Table 6 Capabilities

Parameter

Type

Description

addChildNodePermission

Boolean

Permission to create a file or folder. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

copyPermission

Boolean

Copy permission. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

deletePermission

Boolean

Delete permission. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

downloadPermission

Boolean

Download permission. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

editPermission

Boolean

Edit permissions. true: granted; false: not granted (editing is not supported.)

listChildNodePermission

Boolean

Permission to view the list. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

removeChildNodePermission

Boolean

Move permission. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

renameFilePermission

Boolean

Rename permission. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

shareFilePermission

Boolean

Share permission. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

uploadPermission

Boolean

Upload permission. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

viewPermission

Boolean

Preview permission. The value true indicates that the permission is granted, and the value false indicates that the permission is not granted.

Example Requests

/koodrive/ose/v1/permission/template/create

{
  "company" : "*****",
  "name" : "****",
  "templateType" : 1,
  "description" : "",
  "capabilities" : {
    "listChildNodePermission" : true,
    "viewPermission" : false,
    "editPermission" : false,
    "uploadPermission" : false,
    "downloadPermission" : false,
    "shareFilePermission" : false,
    "removeChildNodePermission" : false,
    "copyPermission" : false,
    "renameFilePermission" : false,
    "deletePermission" : false,
    "addChildNodePermission" : false
  }
}

Example Responses

Status code: 200

Response body for creating a template.

{
  "data" : {
    "id" : "1590******52215169",
    "name" : "*****",
    "description" : "",
    "templateType" : 1,
    "status" : 0,
    "company" : "*****",
    "createTime" : "2025-01-03T07:56:29.450Z",
    "updateTime" : "2025-01-03T07:56:29.450Z",
    "capabilities" : {
      "addChildNodePermission" : false,
      "copyPermission" : false,
      "deletePermission" : false,
      "downloadPermission" : false,
      "editPermission" : false,
      "listChildNodePermission" : true,
      "removeChildNodePermission" : false,
      "renameFilePermission" : false,
      "shareFilePermission" : false,
      "uploadPermission" : false,
      "viewPermission" : false
    }
  },
  "code" : 0,
  "msg" : "Successful."
}

Status Codes

Status Code

Description

200

Response body for creating a template.