Skip to content
Snippets Groups Projects

Fix project member access for group links

1 unresolved thread

What does this MR do?

Among other things, ensure that users who have access to a project through a group link can see confidential issues.

Are there points in the code the reviewer needs to double check?

I tried to keep the change as minimal as possible.

Why was this MR needed?

ProjectTeam#find_member doesn't take group links into account. It was used in two places:

  1. An admin view - it can stay here.
  2. ProjectTeam#member?, which is often used to decide if a user has access to view something.

This second part broke confidential issues viewing. IssuesFinder ends up delegating to Project#authorized_for_user?, which does consider group links, so users with access to the project via a group link could see confidential issues on the index page. However, IssuesPolicy used ProjectTeam#member?, so the same user couldn't view the issue when going to it directly.

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #23872 (closed).

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
  • Grzegorz Bizon
  • @smcgivern Looks awesome ! I just left a few comments related to tests.

  • Reassigned to @smcgivern

  • 125 125 max_member_access(user.id) == Gitlab::Access::MASTER
    126 126 end
    127 127
    128 def member?(user, min_member_access = nil)
    129 member = !!find_member(user.id)
    130
    131 if min_member_access
    132 member && max_member_access(user.id) >= min_member_access
    133 else
    134 member
    135 end
    128 def member?(user, min_member_access = Gitlab::Access::GUEST)
    129 max_member_access(user.id) >= min_member_access
  • Sean McGivern Added 24 commits:

    Added 24 commits:

    Compare with previous version

  • Author Contributor

    @grzesiek changes made! I've created https://gitlab.com/gitlab-org/gitlab-ce/issues/23938 for the discussion in the first couple of comments.

  • Reassigned to @grzesiek

  • @smcgivern Thanks! LGTM 👍

  • Reassigned to @smcgivern

  • Reassigned to @rymai

  • Thanks @smcgivern! This looks very good, thanks for the tests and the followup (#23938 (closed)) but I don't see any tests for members via group links? We should probably test that since that was the original issue?

  • Author Contributor

    @rymai haha whoops! Yes, of course, I will add those now.

  • Reassigned to @smcgivern

  • Author Contributor

    @rymai added some!

  • Reassigned to @rymai

  • Sean McGivern Added 1 commit:

    Added 1 commit:

    • af6cf695 - Add specs for a user from a group link

    Compare with previous version

  • Author Contributor

    @rymai added some!

  • @smcgivern Perfect, thanks!

  • Rémy Coutable Marked the task All builds are passing as completed

    Marked the task All builds are passing as completed

  • Rémy Coutable Mentioned in commit 5742f4a6

    Mentioned in commit 5742f4a6

  • Rémy Coutable Status changed to merged

    Status changed to merged

  • Stan Hu Mentioned in issue #23827 (closed)

    Mentioned in issue #23827 (closed)

  • Picked into 8-13-stable, will go into 8.13.2.

  • Rémy Coutable Removed ~149423 label

    Removed ~149423 label

  • Rémy Coutable Mentioned in commit e35ecccb

    Mentioned in commit e35ecccb

  • Please register or sign in to reply
    Loading