Skip to content

Expose `namespace_id` field for user APIs, when accessed by admin

This change will expose the additional namespace_id field in the following Users API response which returns user information, when executed by an admin (it does not expose namespace_id when executed by a normal user):

  • GET /users
  • GET /users/:id
  • GET /user
  • PUT /users/:id
  • POST /users

The main driver for this is the Terraform GitLab Provider so that we can use the generic Create Project API endpoint with the namespace_id field. E.g. something like that because possible:

data "gitlab_user" "some_user" {
    username = "timo"
}

resource "gitlab_project" "welcome_project" {
    name = "welcome"
    namespace_id = data.gitlab_user.some_user.namespace_id
}

Today, this is not reliably and conveniently possible. We'd have to use the Create Project for User endpoint. So, I guess this is merely a convenient field in the user details I think is worth exposing for a neat API usage experience.

Screenshots

Role GET /users GET /users/:id
Admin Screenshot_from_2022-03-21_20-52-28 Screenshot_from_2022-03-21_20-52-45
Non-Admin Screenshot_from_2022-03-21_20-52-02 Screenshot_from_2022-03-21_20-52-02

/cc @nagyv-gitlab @nmezzopera

Edited by Peter Leitzen

Merge request reports

Loading