Skip to content

Add namespace setting to allow MR approval by author

Tan Le requested to merge 273544-add-namespace-mr-approval-settings into master

What does this MR do?

This MR adds a namespace setting to allow merge request approvals from author. This setting is currently not integrated at the project level.

This feature is behind a feature flag :group_merge_request_approval_settings_feature_flag

Implementation

  • Add a new field allow_merge_request_author_approval to existing payload of GET /groups/:id
  • Allow update via existing endpoint: PUT /groups/:id
  • Update permissions: Admin or Owner role
  • EE License: :group_merge_requess_approval_settings (GitLab Premium)

🐘 Database

Migrate

rake db:migrate:up VERSION=20201215022636
== 20201215022636 AddAllowMergeRequestAuthorApprovalToNamespaceSettings: migrating 
-- add_column(:namespace_settings, :allow_merge_request_author_approval, :boolean, {:default=>true, :null=>false})
   -> 0.0042s
== 20201215022636 AddAllowMergeRequestAuthorApprovalToNamespaceSettings: migrated (0.0132s) 

Revert

rake db:migrate:down VERSION=20201215022636
== 20201215022636 AddAllowMergeRequestAuthorApprovalToNamespaceSettings: reverting 
-- remove_column(:namespace_settings, :allow_merge_request_author_approval)
   -> 0.0017s
== 20201215022636 AddAllowMergeRequestAuthorApprovalToNamespaceSettings: reverted (0.0102s) 

Currently, there is about 9,408,734 records in namespace_settings table that will be impacted by this migration.

gitlabhq_production=> select count(*) from namespace_settings;
  count
---------
 9408734
(1 row)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #273544 (closed)

Edited by Tan Le

Merge request reports