Skip to content
Snippets Groups Projects

Add ability to add read_code to custom roles

Merged Jessie Young requested to merge jy-custom-role-view-code into master
All threads resolved!

What does this MR do and why?

  • download_code and read_code are now separate via #376180 (closed)
  • for the first iteration of a customer-facing MVC, we want to provide the ability to customize read_code for a Guest user.
  • We previously added the ability to customize download_code but we will be removing that for the customer MVC.
  • This is all behind the customizable_roles feature flag
  • #20277 (closed)

Database

UserMemberRolesInProjectsPreloader query before this change: https://explain.depesz.com/s/shQU

UserMemberRolesInProjectsPreloader query after this change: https://explain.depesz.com/s/yP4E

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Jessie Young

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
  • Ghost User
  • Jessie Young added 337 commits

    added 337 commits

    Compare with previous version

    • Author Maintainer
      Resolved by Jessie Young

      Hi @sgarg_gitlab - this needs a database review and I need to prepare a few things for DB review before I tag those folks but can you review this for ~"group::authentication and authorization" in the meantime?

      The pipeline/spec failures are all for a single N+1 spec. be rspec spec/requests/projects/ml/experiments_controller_spec.rb:55 also fails on an updated local master so I don't think that it is related to my MR but I have asked about this in Slack.

  • Jessie Young requested review from @sgarg_gitlab

    requested review from @sgarg_gitlab

  • Author Maintainer

    @ifarkas just an FYI on this MR. I spoke with @adil.farrukh today about the custom roles plan for %15.7 and even though we hope to move forward with Draft: POC: use flag_shih_tzu gem for storing p... (!106151 - closed) or similar for custom roles in the future, that is still in flux so in the meantime we are going to add a boolean field for read_code

  • Jessie Young resolved all threads

    resolved all threads

  • Jessie Young removed review request for @sgarg_gitlab

    removed review request for @sgarg_gitlab

  • Jessie Young added 1 commit

    added 1 commit

    • 414b947d - Add ability to add read_code to custom roles

    Compare with previous version

  • Jessie Young changed the description

    changed the description

  • Jessie Young added 1 commit

    added 1 commit

    Compare with previous version

  • Jessie Young mentioned in merge request !102450 (merged)

    mentioned in merge request !102450 (merged)

  • Jessie Young marked the checklist item I have evaluated the MR acceptance checklist for this MR. as completed

    marked the checklist item I have evaluated the MR acceptance checklist for this MR. as completed

  • Jessie Young
  • Jessie Young
  • Jessie Young
  • Jessie Young
  • Jessie Young
  • Jessie Young
  • Author Maintainer

    :wave: @terrichu - can you review this for database please?

    :wave: @sgarg_gitlab this is ready for ~"group::authentication and authorization" review now :smile_cat:

  • Jessie Young requested review from @terrichu and @sgarg_gitlab

    requested review from @terrichu and @sgarg_gitlab

  • Database migrations (on the main database)

    Migrations included in this change have been executed on gitlab.com data for testing purposes. For details, please see the migration testing pipeline (limited access).

    Migration Type Total runtime Result DB size change
    20221206222032 - AddReadCodeToMemberRoles Regular 2.1 s :white_check_mark: +0.00 B
    Runtime Histogram for all migrations
    Query Runtime Count
    0 seconds - 0.01 seconds 0
    0.01 seconds - 0.1 seconds 3
    0.1 seconds - 1 second 0
    1 second - 5 seconds 0
    5 seconds - 15 seconds 0
    15 seconds - 5 minutes 0
    5 minutes + 0

    Migration: 20221206222032 - AddReadCodeToMemberRoles

    • Type: Regular
    • Duration: 2.1 s
    • Database size change: +0.00 B
    Query Calls Total Time Max Time Mean Time Rows
    ALTER TABLE "member_roles" ADD "read_code" boolean DEFAULT FALSE /*application:test,db_config_name:main,line:/db/migrate/20221206222032_add_read_code_to_member_roles.rb:5:in `change'*/
    1 7.8 ms 7.8 ms 7.8 ms 0
    SELECT "feature_gates".*
    FROM "feature_gates" WHERE "feature_gates"."feature_key" = $1 /*application:test,db_config_name:main,line:/lib/feature.rb:249:in `block in current_feature_value'*/
    1 0.0 ms 0.0 ms 0.0 ms 0
    SELECT $1::regtype::oid
    1 0.0 ms 0.0 ms 0.0 ms 1
    Histogram for AddReadCodeToMemberRoles
    Query Runtime Count
    0 seconds - 0.01 seconds 0
    0.01 seconds - 0.1 seconds 3
    0.1 seconds - 1 second 0
    1 second - 5 seconds 0
    5 seconds - 15 seconds 0
    15 seconds - 5 minutes 0
    5 minutes + 0

    Background migrations


    Other migrations pending on GitLab.com
    Migration Type Total runtime Result DB size change

    Clone Details

    Clone ID Clone Created At Clone Data Timestamp Expected Removal Time
    database-testing-1591497-8697949-main 2022-12-07T21:47:47Z 2022-12-07T20:10:07Z 2022-12-08 09:51:12 +0000
    database-testing-1591497-8697949-ci 2022-12-07T21:47:48Z 2022-12-07T20:46:07Z 2022-12-08 09:51:12 +0000

    Artifacts


    Brought to you by gitlab-org/database-team/gitlab-com-database-testing. Epic

    Database migrations (on the ci database)

    Migrations included in this change have been executed on gitlab.com data for testing purposes. For details, please see the migration testing pipeline (limited access).

    Migration Type Total runtime Result DB size change
    20221206222032 - AddReadCodeToMemberRoles Regular 2.2 s :white_check_mark: +0.00 B
    Runtime Histogram for all migrations
    Query Runtime Count
    0 seconds - 0.01 seconds 0
    0.01 seconds - 0.1 seconds 3
    0.1 seconds - 1 second 0
    1 second - 5 seconds 0
    5 seconds - 15 seconds 0
    15 seconds - 5 minutes 0
    5 minutes + 0

    Migration: 20221206222032 - AddReadCodeToMemberRoles

    • Type: Regular
    • Duration: 2.2 s
    • Database size change: +0.00 B
    Query Calls Total Time Max Time Mean Time Rows
    ALTER TABLE "member_roles" ADD "read_code" boolean DEFAULT FALSE /*application:test,db_config_name:ci,line:/db/migrate/20221206222032_add_read_code_to_member_roles.rb:5:in `change'*/
    1 15.1 ms 15.1 ms 15.1 ms 0
    SELECT $1::regtype::oid
    1 0.0 ms 0.0 ms 0.0 ms 1
    Histogram for AddReadCodeToMemberRoles
    Query Runtime Count
    0 seconds - 0.01 seconds 0
    0.01 seconds - 0.1 seconds 3
    0.1 seconds - 1 second 0
    1 second - 5 seconds 0
    5 seconds - 15 seconds 0
    15 seconds - 5 minutes 0
    5 minutes + 0

    Background migrations


    Other migrations pending on GitLab.com
    Migration Type Total runtime Result DB size change

    Clone Details

    Clone ID Clone Created At Clone Data Timestamp Expected Removal Time
    database-testing-1591497-8697949-main 2022-12-07T21:47:47Z 2022-12-07T20:10:07Z 2022-12-08 09:51:12 +0000
    database-testing-1591497-8697949-ci 2022-12-07T21:47:48Z 2022-12-07T20:46:07Z 2022-12-08 09:51:12 +0000

    Artifacts


    Brought to you by gitlab-org/database-team/gitlab-com-database-testing. Epic

  • Eduardo Bonet mentioned in merge request !106241 (merged)

    mentioned in merge request !106241 (merged)

  • Smriti Garg
  • Smriti Garg approved this merge request

    approved this merge request

  • Smriti Garg removed review request for @sgarg_gitlab

    removed review request for @sgarg_gitlab

  • Mario Celi mentioned in issue #385205

    mentioned in issue #385205

  • Jessie Young requested review from @reprazent

    requested review from @reprazent

  • Terri Chu
  • Terri Chu
  • Terri Chu removed review request for @terrichu

    removed review request for @terrichu

  • Jessie Young requested review from @terrichu

    requested review from @terrichu

  • Terri Chu approved this merge request

    approved this merge request

  • added databasereviewed label and removed databasereview pending label

  • Terri Chu requested review from @mattkasa and removed review request for @terrichu

    requested review from @mattkasa and removed review request for @terrichu

  • :wave: @terrichu, thanks for approving this merge request.

    This is the first time the merge request is approved. To ensure full test coverage, a new pipeline will be started shortly.

    For more info, please refer to the following links:

  • mentioned in issue #385221 (closed)

  • Matt Kasa
  • Matt Kasa
  • Matt Kasa
  • Jessie Young added 1 commit

    added 1 commit

    • 026751c7 - Clean up project member references in specs

    Compare with previous version

  • Jessie Young added 1 commit

    added 1 commit

    Compare with previous version

  • Bob Van Landuyt approved this merge request

    approved this merge request

  • Bob Van Landuyt removed review request for @reprazent

    removed review request for @reprazent

  • Matt Kasa approved this merge request

    approved this merge request

  • added databaseapproved label and removed databasereviewed label

  • Matt Kasa resolved all threads

    resolved all threads

  • Matt Kasa enabled an automatic merge when the pipeline for 973d2157 succeeds

    enabled an automatic merge when the pipeline for 973d2157 succeeds

  • merged

  • @jessieay, how was your code review experience with this merge request? Please tell us how we can continue to iterate and improve:

    1. React with a :thumbsup: or a :thumbsdown: on this comment to describe your experience.
    2. Create a new comment starting with @gitlab-bot feedback below, and leave any additional feedback you have for us in the comment.

    Interested in learning more tips and tricks to solve your next challenge faster? Subscribe to the GitLab Community Newsletter for contributor-focused content and opportunities to level up.

    Thanks for your help! :heart:

    This message was generated automatically. You're welcome to improve it.

  • Matt Kasa mentioned in commit c09f2c2d

    mentioned in commit c09f2c2d

  • added workflowstaging label and removed workflowcanary label

  • mentioned in issue #20277 (closed)

  • mentioned in issue #388156 (closed)

  • Jarka Košanová mentioned in merge request !115707 (merged)

    mentioned in merge request !115707 (merged)

  • Jarka Košanová mentioned in merge request !114734 (merged)

    mentioned in merge request !114734 (merged)

  • Jarka Košanová mentioned in merge request !122635 (merged)

    mentioned in merge request !122635 (merged)

  • mo khan mentioned in issue #437947 (closed)

    mentioned in issue #437947 (closed)

  • Please register or sign in to reply
    Loading