Updating the Push Permissions of Repository Files in Batches
Function
This API is used to update the push permission of repository files in batches.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.
|
Action |
Access Level |
Resource Type (*: required) |
Condition Key |
Alias |
Dependencies |
|---|---|---|---|---|---|
|
codeartsrepo:repository:setRepository |
Write |
- |
- |
- |
- |
URI
PUT https://{hostURL}/v4/repositories/{repository_id}/file-push-permissions
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
repository_id |
Yes |
Integer |
Definition You can query the project list to obtain the repository ID by calling the API used to query user's all repositories. Constraints N/A Default Value N/A Value range: 1~2147483647 |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Definition User token. Obtain one by calling the IAM API Obtaining a User Token. The value of X-Subject-Token in the response header is a token. Constraints N/A Range 1–100,000 characters. Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
permissions |
No |
Array of FilePushPermissionUpdateDto objects |
Definition File push permission update list. Constraints N/A Range N/A Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
No |
Integer |
Definition Repository file push permission ID. Constraints N/A Range N/A Default Value N/A Value range: 1~2147483647 |
|
path |
No |
String |
Definition Directory path or wildcard. Constraints N/A Range N/A Default Value N/A |
|
actions |
No |
Array of FilePushPermissionActionBodyDto objects |
Definition Event setting list. Constraints N/A Range N/A Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
enable |
No |
Boolean |
Definition: Whether to enable. Constraints: N/A. Value range:
Default value: N/A. Default value: true |
|
user_ids |
No |
Array of objects |
Definition: User ID list. Constraints: N/A. Value range: Integer Default value: N/A. Value range: 1~2147483647 |
|
user_team_ids |
No |
Array of integers |
Definition: Member group ID list. Constraints: N/A. Value range: N/A. Default value: N/A. Value range: 1~2147483647 |
|
related_role_ids |
No |
Array of strings |
Definition: Associated role ID list. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
action |
No |
String |
Definition Event name. Constraints N/A Range
Default Value N/A Enumeration values:
|
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
[items] |
Array of RepositoryFilePushPermissionDto objects |
Repository file push permission list. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
Integer |
Definition Repository file push permission ID. Range 1-2147483647 Value range: 1~2147483647 |
|
path |
String |
Definition Directory path or wildcard. Range N/A |
|
actions |
Array of RepositoryProtectedActionDto objects |
Definition Event list. Range N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
action |
String |
Definition: Event name. Value range: N/A. |
|
enable |
Boolean |
Definition: Whether to enable. Value range:
|
|
users |
Array of RepositoryUserDto objects |
Definition: Whitelisted user list. Value range: N/A. |
|
user_teams |
Array of UserTeamBasicDto objects |
Definition: Whitelisted user group list. Value range: N/A. |
|
roles |
Array of BasicRoleDto objects |
Definition: Whitelisted role list. Value range: N/A. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
Integer |
Definition User ID. Value range: 1~2147483647 |
|
name |
String |
Definition Username. |
|
username |
String |
Definition Username. |
|
state |
String |
Definition: User status Value range:
Enumeration values:
|
|
avatar_url |
String |
Definition: Profile picture URL. Value range: N/A. |
|
nick_name |
String |
Definition: User alias. Value range: N/A. |
|
tenant_name |
String |
Definition: Tenant name. Value range: N/A. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
Integer |
Definition: User group ID. Value range: 1–2147483647 |
|
name |
String |
Definition: User group name. Value range: N/A. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
Integer |
Definition: Role ID. Value range: 1–2147483647 |
|
name |
String |
Definition: Role name. Value range: N/A. |
|
related_role_id |
String |
Definition: Associated role ID. Value range: N/A. |
|
chinese_name |
String |
Definition: Role name in Chinese. Value range: N/A. |
Example Requests
Update the push permission of repository files in batches.
PUT /v4/repositories/123/file-push-permissions
{
"permissions" : [ {
"id" : 5,
"path" : "/config/*",
"actions" : [ {
"action" : "push",
"enable" : true,
"user_ids" : [ 9124 ],
"user_team_ids" : [ 247 ],
"related_role_ids" : [ "24f72d0b611746c3a43da596ea5065f5" ]
} ]
} ]
}
Example Responses
Status code: 200
Repository file push permission list.
[ {
"id" : 44,
"path" : "33",
"actions" : [ {
"action" : "push",
"enable" : true,
"users" : [ {
"id" : 7574,
"name" : "user",
"username" : "a618e34bd5704be3ae3395dfede06041",
"state" : "active",
"avatar_url" : "",
"nick_name" : "user",
"tenant_name" : "tenant"
} ],
"user_teams" : [ {
"id" : 247,
"name" : "team-1"
} ],
"roles" : [ {
"id" : 23836594,
"name" : "Project manager",
"related_role_id" : "6115a3ddd9044e288c558d1ae827a732",
"chinese_name" : "Project manager"
} ]
} ]
} ]
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Repository file push permission list. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot