Feature #23307

Get which auth_source_id of a user

Added by Roger MÃ¥rtensson over 3 years ago. Updated about 1 month ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:REST API
Target version:Candidate for next major release
Resolution:

Description

it would've been nice to be able to get which auth_source_id a given user has through the REST API. A nice complement to when creating user where it is possible to set the auth_source_id.

add_auth_source_id_to_api.patch Magnifier (3.92 KB) Anonymous, 2018-02-06 18:00

0001-Add-auth_source-to-the-users-API-response.patch Magnifier (1.8 KB) Go MAEDA, 2019-09-08 05:03


Related issues

Related to Redmine - Feature #23306: Support for authentication sources in REST API New

History

#1 Updated by Toshi MARUYAMA about 3 years ago

  • Related to Feature #23306: Support for authentication sources in REST API added

#2 Updated by Anonymous over 1 year ago

I agree. This feature is also useful for admin scripts which needs to distinguish between "external" and LDAP users.

I attached a patch for this feature. auth_source_id only gets visible for admin users in it, as I do not see the need for standard users.

#3 Updated by Anonymous over 1 year ago

@Toshi MARUYAMA : Do you have an opinion on this issue?

#4 Updated by Roger MÃ¥rtensson about 1 year ago

What is the status of this issue?

#5 Updated by Go MAEDA about 1 year ago

  • Target version set to Candidate for next major release

#6 Updated by Go MAEDA about 1 month ago

I think the response should include not only id but also name. Maybe the response does not include "auth_source" if the user uses internal authentication.

{
  "user": {
    "id": 1,
    "login": "admin",
    "firstname": "Redmine",
    "lastname": "Admin",
    "created_on": "2006-07-19T17:12:21Z",
    "last_login_on": "2019-09-06T06:37:53Z",
    "auth_source": {
      "id": 1,
      "name": "LDAP test server" 
    }
  }
}

#7 Updated by Go MAEDA about 1 month ago

Here is a patch to add auth_source to the response of GET /users/:id.(xml|json). auth_source is included only when the users auth_source is not nil and the current user is an administrator.

    "auth_source": {
      "id": 1,
      "name": "LDAP test server" 
    },

Also available in: Atom PDF