Skip to content

Organization Users - Use proper permissions

Zack Cuddy requested to merge zcuddy-organization-users-view-permissions into master

What does this MR do and why?

The grouptenant scale team is starting to build out an Organization MVC. For more information about what an "Organization" will be see https://docs.gitlab.com/ee/architecture/blueprints/organization/

Fixes concern raised here: #409313 (comment 1659731657)

The GraphQL Endpoint for Organization Users utilizes the permission read_organization_user while the UI currently uses read_organization. This is a disconnect and the UI should also be using the stricter read_organization_user permission.

This change aligns the two.

This change is behind a feature flag (:ui_for_organizations)

Screenshots or screen recordings

Signed in as a user of the organization

No changes

Before After
Screenshot_2023-11-29_at_9.06.00_AM Screenshot_2023-11-29_at_9.06.00_AM

Signed in as a user that is not part of the organization

Before After
Screenshot_2023-11-29_at_9.08.07_AM Screenshot_2023-11-29_at_9.05.40_AM

How to set up and validate locally

  1. Open the Rails console
    • bin/rails console
  2. Enable FF
    • Feature.enable(:ui_for_organizations)
  3. Add yourself to the default organization
    • Organizations::OrganizationUser.create!(user_id: User.find_by_username(<your username>).id, organization_id: 1)

With Permissions

  1. Sign in with the user you added as an organization user above
  2. Go to Default Organization path (http://127.0.0.1:3000/-/organizations/default)
  3. In left nav, click Manage => Users
  4. Ensuring Loading icon temporarily and then once complete the Users Table appears

Without Permissions

  1. Impersonate another user
  2. Go to Default Organization path (http://127.0.0.1:3000/-/organizations/default)
  3. Ensure left nav does not have the Manage => Users option
  4. Ensuring directly going to the path 404s (http://127.0.0.1:3000/-/organizations/default/users)

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 Peter Hegman

Merge request reports