Skip to content
Snippets Groups Projects

Add managing protected branches as custom permission

Merged Jarka Košanová requested to merge 448823-protected-branches-cr into master
1 unresolved thread

What does this MR do and why?

It adds managing protected branches as a custom ability.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screen_Recording_2024-08-12_at_18.09.50

How to set up and validate locally

  1. Create a new member group, that enables "manage protected branch" ability, for self-managed on admin - Roles and permissions page, eg. http://gdk.test:3000/admin/application_settings/roles_and_permissions
  2. Visit any group or project member pages such as http://gdk.test:3000/groups/flightjs/-/group_members and assign this custom role to a user
  3. Impersonate this user and go to the project settings - repository page, eg. http://gdk.test:3000/flightjs/Flight/-/settings/repository
  4. Make sure you see Branch rules and Protected branches section
  5. Play around with protected branches

Related to #448823 (closed)

Edited by Jarka Košanová

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Security policy violations have been resolved.

    Edited by GitLab Security Bot
  • added 1 commit

    • 94df7897 - mock gon abilities in frontend tests

    Compare with previous version

  • :tools: Generated by gitlab_quality-test_tooling.


    :snail: Slow tests detected in this merge request. These slow tests might be related to this merge request's changes.

    Click to expand
    Job File Name Duration Expected duration
    #7543683988 ee/spec/features/projects/protected_branches_spec.rb#L42 Protected Branches when logged in as maintainer behaves like setting project protected branches explicit protected branches allows creating explicit protected branches 53.4 s < 50.13 s
    #7598174063 spec/lib/release_highlights/validator_spec.rb#L82 ReleaseHighlights::Validator when validating all files they should have no errors 85.65 s < 27.12 s
    #7601139991 spec/lib/release_highlights/validator_spec.rb#L82 ReleaseHighlights::Validator when validating all files they should have no errors 95.3 s < 27.12 s
    #7607292087 spec/lib/release_highlights/validator_spec.rb#L82 ReleaseHighlights::Validator when validating all files they should have no errors 78.96 s < 27.12 s
    #7609729647 spec/lib/release_highlights/validator_spec.rb#L82 ReleaseHighlights::Validator when validating all files they should have no errors 74.04 s < 27.12 s
    #7628308947 spec/lib/release_highlights/validator_spec.rb#L82 ReleaseHighlights::Validator when validating all files they should have no errors 86.3 s < 27.12 s
    #7636237476 spec/lib/release_highlights/validator_spec.rb#L82 ReleaseHighlights::Validator when validating all files they should have no errors 85.52 s < 27.12 s
    #7689445111 spec/lib/release_highlights/validator_spec.rb#L82 ReleaseHighlights::Validator when validating all files they should have no errors 77.14 s < 27.12 s
    #7728420910 spec/lib/release_highlights/validator_spec.rb#L82 ReleaseHighlights::Validator when validating all files they should have no errors 79.07 s < 27.12 s
  • A deleted user added rspec:slow test detected label
  • added 1 commit

    • 89b258a9 - mock gon abilities in frontend tests

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Jarka Košanová changed the description

    changed the description

  • mentioned in issue #448823 (closed)

  • Jarka Košanová requested review from @hmehra

    requested review from @hmehra

  • Jarka Košanová changed the description

    changed the description

  • Jarka Košanová changed milestone to %17.4

    changed milestone to %17.4

  • Jarka Košanová added 280 commits

    added 280 commits

    Compare with previous version

  • Hinam Mehra
  • Hinam Mehra
  • added 1 commit

    • c1014a52 - Remove access to branch rules for manage prot branches custom ability

    Compare with previous version

  • Bundle size analysis [beta]

    This compares changes in bundle size for entry points between the commits a4cb1501 and 327e41fb

    :sparkles: Special assets

    Entrypoint / Name Size before Size after Diff Diff in percent
    average 4.33 MB 4.33 MB - 0.0 %
    mainChunk 3.27 MB 3.27 MB - 0.0 %

    Note: We do not have exact data for a4cb1501. So we have used data from: d3c19f6c.
    The intended commit has no webpack pipeline, so we chose the last commit with one before it.

    Please look at the full report for more details


    Read more about how this report works.

    Generated by :no_entry_sign: Danger

  • added 1 commit

    • 99421abd - Remove access to branch rules for manage prot branches custom ability

    Compare with previous version

  • Jarka Košanová requested review from @hmehra

    requested review from @hmehra

  • Hinam Mehra approved this merge request

    approved this merge request

  • Before you set this MR to auto-merge

    This merge request will progress on pipeline tiers until it reaches the last tier: pipelinetier-3. We will trigger a new pipeline for each transition to a higher tier.

    Before you set this MR to auto-merge, please check the following:

    • You are the last maintainer of this merge request
    • The latest pipeline for this merge request is pipelinetier-3 (You can find which tier it is in the pipeline name)
    • This pipeline is recent enough (created in the last 8 hours)

    If all the criteria above apply, please set auto-merge for this merge request.

    See pipeline tiers and merging a merge request for more details.

  • requested review from @apennells, @hmerscher, and @digitalmoksha

  • Hinam Mehra removed review request for @hmehra

    removed review request for @hmehra

  • E2E Test Result Summary

    allure-report-publisher generated test report!

    e2e-test-on-gdk: :white_check_mark: test report for 327e41fb

    expand test summary
    +------------------------------------------------------------------+
    |                          suites summary                          |
    +-------------+--------+--------+---------+-------+-------+--------+
    |             | passed | failed | skipped | flaky | total | result |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Data Stores | 31     | 0      | 1       | 0     | 32    | ✅     |
    | Verify      | 44     | 0      | 2       | 0     | 46    | ✅     |
    | Create      | 128    | 0      | 16      | 0     | 144   | ✅     |
    | Govern      | 71     | 0      | 0       | 0     | 71    | ✅     |
    | Plan        | 73     | 0      | 0       | 0     | 73    | ✅     |
    | Fulfillment | 2      | 0      | 0       | 0     | 2     | ✅     |
    | Package     | 20     | 0      | 12      | 0     | 32    | ✅     |
    | Release     | 5      | 0      | 0       | 0     | 5     | ✅     |
    | Manage      | 1      | 0      | 1       | 0     | 2     | ✅     |
    | Analytics   | 2      | 0      | 0       | 0     | 2     | ✅     |
    | Monitor     | 8      | 0      | 0       | 0     | 8     | ✅     |
    | Secure      | 3      | 0      | 0       | 0     | 3     | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Total       | 388    | 0      | 32      | 0     | 420   | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+

    e2e-package-and-test: :white_check_mark: test report for 99421abd

    expand test summary
    +-------------------------------------------------------------+
    |                       suites summary                        |
    +--------+--------+--------+---------+-------+-------+--------+
    |        | passed | failed | skipped | flaky | total | result |
    +--------+--------+--------+---------+-------+-------+--------+
    | Govern | 107    | 0      | 6       | 0     | 113   | ✅     |
    | Create | 270    | 0      | 34      | 0     | 304   | ✅     |
    +--------+--------+--------+---------+-------+-------+--------+
    | Total  | 377    | 0      | 40      | 0     | 417   | ✅     |
    +--------+--------+--------+---------+-------+-------+--------+
  • Author Maintainer

    I am in the process of checking the failing jobs

  • added 1 commit

    • ae581a6d - Push frontend abilities from group repo settings controller

    Compare with previous version

  • Jarka Košanová reset approvals from @hmehra by pushing to the branch

    reset approvals from @hmehra by pushing to the branch

  • added 1 commit

    • 5de5bef9 - Push frontend abilities from controllers using access_dropdown

    Compare with previous version

  • Jarka Košanová added 1090 commits

    added 1090 commits

    • 5de5bef9...4adb323d - 1087 commits from branch master
    • 19f5d8d1 - Add managing protected branches as custom permission
    • 5bbe8efc - Remove access to branch rules for manage prot branches custom ability
    • ecc2abb5 - Push frontend abilities from controllers using access_dropdown

    Compare with previous version

  • Alex Pennells
  • Alex Pennells
  • Alex Pennells
  • Brett Walker removed review request for @digitalmoksha

    removed review request for @digitalmoksha

  • Jarka Košanová
  • added 1 commit

    • cf723c81 - Small improvements, adding tests, fixing typos

    Compare with previous version

  • requested review from @apennells

  • requested review from @digitalmoksha

  • Brett Walker approved this merge request

    approved this merge request

  • Brett Walker removed review request for @digitalmoksha

    removed review request for @digitalmoksha

  • Alex Pennells
  • added 1 commit

    • 04709324 - Use glAbilitiesMixin instead of gon

    Compare with previous version

  • Jarka Košanová reset approvals from @digitalmoksha by pushing to the branch

    reset approvals from @digitalmoksha by pushing to the branch

  • Hercules Merscher removed review request for @hmerscher

    removed review request for @hmerscher

  • Hercules Merscher approved this merge request

    approved this merge request

  • requested review from @apennells

  • Alex Pennells approved this merge request

    approved this merge request

  • Alex Pennells requested review from @sdejonge and removed review request for @apennells

    requested review from @sdejonge and removed review request for @apennells

  • Jarka Košanová added 1766 commits

    added 1766 commits

    • 04709324...8c287fc6 - 1760 commits from branch master
    • 3217cc5e - Add managing protected branches as custom permission
    • 31e8f23d - Remove access to branch rules for manage prot branches custom ability
    • 06d50d92 - Push frontend abilities from controllers using access_dropdown
    • c7ec62ca - Small improvements, adding tests, fixing typos
    • c18b6a93 - Use glAbilitiesMixin instead of gon
    • 327e41fb - Improve specs for settings menu when custom ab taking effect

    Compare with previous version

  • Scott de Jonge approved this merge request

    approved this merge request

  • Scott de Jonge removed review request for @sdejonge

    removed review request for @sdejonge

  • mentioned in issue #481958

  • Brett Walker approved this merge request

    approved this merge request

  • Jarka Košanová resolved all threads

    resolved all threads

  • Jarka Košanová requested review from @hmehra

    requested review from @hmehra

  • Hinam Mehra approved this merge request

    approved this merge request

  • Hinam Mehra enabled automatic add to merge train when checks pass

    enabled automatic add to merge train when checks pass

  • Hinam Mehra resolved all threads

    resolved all threads

  • merged

  • Hinam Mehra mentioned in commit fcff268a

    mentioned in commit fcff268a

  • Chaoyue Zhao mentioned in merge request !164964 (merged)

    mentioned in merge request !164964 (merged)

  • Jarka Košanová resolved all threads

    resolved all threads

  • mentioned in issue #482942 (closed)

  • added workflowstaging label and removed workflowcanary label

  • 6 6 extend ActiveSupport::Concern
    7 7 extend Grape::API::Helpers
    8 8
    9 def authorize_create_protected_branch!
    10 authorize!(:create_protected_branch, user_project)
    11 end
    12
    13 def authorize_update_protected_branch!(protected_branch)
    14 authorize!(:update_protected_branch, protected_branch)
    15 end
    16
    17 def authorize_destroy_protected_branch!(protected_branch)
    18 authorize!(:read_protected_branch, protected_branch)
  • Jarka Košanová mentioned in merge request !175876 (merged)

    mentioned in merge request !175876 (merged)

    • Resolved by Joe Randazzo

      Hi @jarka, thanks for working on this! Do we have any plans to break this down further into the individual (create, read, update, destroy) underlying permissions? One of my customers would be very interested in this.

  • David Dieulivol mentioned in issue #515305

    mentioned in issue #515305

  • Please register or sign in to reply
    Loading