Commit ecd631f1 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch...

Merge branch '197292-support-require_password_to_approve-in-post-projects-id-approvals-api-endpoint' into 'master'

Support require_password_to_approve in POST /projects/:id/approvals API endpoint

Closes #197292

See merge request gitlab-org/gitlab!24016
parents b398510f c64e82d4
---
title: Support require_password_to_approve in project merge request approvals API
merge_request: 24016
author:
type: added
......@@ -25,7 +25,10 @@ GET /projects/:id/approvals
{
"approvals_before_merge": 2,
"reset_approvals_on_push": true,
"disable_overriding_approvers_per_merge_request": false
"disable_overriding_approvers_per_merge_request": false,
"merge_requests_author_approval": true,
"merge_requests_disable_committers_approval": false,
"require_password_to_approve": true
}
```
......@@ -50,6 +53,7 @@ POST /projects/:id/approvals
| `disable_overriding_approvers_per_merge_request` | boolean | no | Allow/Disallow overriding approvers per MR |
| `merge_requests_author_approval` | boolean | no | Allow/Disallow authors from self approving merge requests; `true` means authors cannot self approve |
| `merge_requests_disable_committers_approval` | boolean | no | Allow/Disallow committers from self approving merge requests |
| `require_password_to_approve` | boolean | no | Require approver to enter a password in order to authenticate before adding the approval |
```json
{
......@@ -57,7 +61,8 @@ POST /projects/:id/approvals
"reset_approvals_on_push": true,
"disable_overriding_approvers_per_merge_request": false,
"merge_requests_author_approval": false,
"merge_requests_disable_committers_approval": false
"merge_requests_disable_committers_approval": false,
"require_password_to_approve": true
}
```
......@@ -441,7 +446,10 @@ PUT /projects/:id/approvers
],
"approvals_before_merge": 2,
"reset_approvals_on_push": true,
"disable_overriding_approvers_per_merge_request": false
"disable_overriding_approvers_per_merge_request": false,
"merge_requests_author_approval": true,
"merge_requests_disable_committers_approval": false,
"require_password_to_approve": true
}
```
......
......@@ -30,7 +30,8 @@ module API
optional :disable_overriding_approvers_per_merge_request, type: Boolean, desc: 'Should MRs be able to override approvers and approval count'
optional :merge_requests_author_approval, type: Boolean, desc: 'Should merge request authors be able to self approve merge requests; `true` means authors cannot self approve'
optional :merge_requests_disable_committers_approval, type: Boolean, desc: 'Should committers be able to self approve merge requests'
at_least_one_of :approvals_before_merge, :reset_approvals_on_push, :disable_overriding_approvers_per_merge_request, :merge_requests_author_approval, :merge_requests_disable_committers_approval
optional :require_password_to_approve, type: Boolean, desc: 'Should approvers authenticate via password before adding approval'
at_least_one_of :approvals_before_merge, :reset_approvals_on_push, :disable_overriding_approvers_per_merge_request, :merge_requests_author_approval, :merge_requests_disable_committers_approval, :require_password_to_approve
end
post '/' do
project_params = declared(params, include_missing: false, include_parent_namespaces: false)
......
......@@ -506,6 +506,7 @@ module EE
expose :disable_overriding_approvers_per_merge_request
expose :merge_requests_author_approval
expose :merge_requests_disable_committers_approval
expose :require_password_to_approve
end
class Approvals < Grape::Entity
......
......@@ -6,6 +6,7 @@
"reset_approvals_on_push": { "type": "boolean" },
"merge_requests_author_approval": { "type": ["boolean", "null"] },
"merge_requests_disable_committers_approval": { "type": ["boolean", "null"] },
"require_password_to_approve": { "type": ["boolean", "null"] },
"approvers": {
"type": "array",
"items": {
......
......@@ -69,6 +69,7 @@ describe API::ProjectApprovals do
project.disable_overriding_approvers_per_merge_request = true
project.merge_requests_author_approval = false
project.merge_requests_disable_committers_approval = true
project.require_password_to_approve = false
project.save
settings = {
......@@ -76,7 +77,8 @@ describe API::ProjectApprovals do
reset_approvals_on_push: true,
disable_overriding_approvers_per_merge_request: false,
merge_requests_author_approval: true,
merge_requests_disable_committers_approval: false
merge_requests_disable_committers_approval: false,
require_password_to_approve: true
}
post api(url, current_user), params: settings
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment