Skip to content

Service to generate User Permission export

Aishwarya Subramanian requested to merge user-permissions-query into master

What does this MR do?

This MR adds a service to generate a CSV for User Permission export.

An example csv:

Username Email Type Path Access Level Inherited memberships
root admin@example.com Group gitlab-org Owner gitlab-org/subgroup-one;gitlab-org/test-project
ellen ellen@example.com Sub Group comcast Developer
marie marie@example.com Project gitlab-org/gitlab Maintainer gitlab-org/gitlab/test
  • The feature is licensed for Gitlab Premium and higher tiers
  • The feature is gated behind the flag: export_user_permissions_feature_flag
  • The export is available for only instance administrators
  • Inherited memberships include only direct memberships in this iteration
  • The CSV file is streamed, using the feature introduced in !47268 (merged)

Mentions #273482 (closed)

Database

Query:

SELECT
    "members".*
FROM
    "members"
    LEFT OUTER JOIN "users" ON "members"."user_id" = "users"."id"
WHERE
    "users"."state" = 'active'
    AND "members"."requested_at" IS NULL
    AND "members"."invite_token" IS NULL
    AND (members.access_level > 5)
ORDER BY
    "members"."id" ASC
LIMIT 1000

Execution plan: https://explain.depesz.com/s/omxd

Cold Cache:

Time: 105.710 ms
  - planning: 0.627 ms
  - execution: 105.083 ms
    - I/O read: 96.233 ms
    - I/O write: 0.000 ms

Shared buffers:
  - hits: 3263 (~25.50 MiB) from the buffer pool
  - reads: 776 (~6.10 MiB) from the OS file cache, including disk I/O
  - dirtied: 33 (~264.00 KiB)
  - writes: 0

Warm cache:

Time: 4.707 ms
  - planning: 0.597 ms
  - execution: 4.110 ms
    - I/O read: 0.000 ms
    - I/O write: 0.000 ms

Shared buffers:
  - hits: 4039 (~31.60 MiB) from the buffer pool
  - reads: 0 from the OS file cache, including disk I/O
  - dirtied: 0
  - writes: 0

Screenshots (strongly suggested)

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
Edited by Aishwarya Subramanian

Merge request reports