Skip to content

Resolve "add user phone api"

What does this MR do and why?

The history of UserPublic

  1. Renamed from UserFull
  2. Dont expose user email via API
  3. Derived from lib/api/entities.rb

Which APIs will be effected

  1. /user from source code to show the user detail of the authenticated user self
  2. /users from several parts like here for admin only
  3. /keys from source code to show user keys with user detail, which can be queried by admin or by deploy key fingerprint

Changes

  1. add phone field to Gets currently authenticated user for normal user on JiHu SaaS.

How to make a request

Request

GET {{APP_PATH}}/api/v4/user

Response

{
    "id": 134,
    "username": "mtan-jh-3",
    "name": "mtan-jh-3",
    "state": "active",
    "avatar_url": "https://www.gravatar.com/avatar/?s=80&d=identicon",
    "web_url": "http://172.16.123.1:3000/mtan-jh-3",
    "created_at": "2022-09-05T04:19:04.623Z",
    "bio": "",
    "location": null,
    "public_email": null,
    "skype": "",
    "linkedin": "",
    "twitter": "",
    "website_url": "",
    "organization": null,
    "job_title": "",
    "pronouns": null,
    "bot": false,
    "work_information": null,
    "followers": 0,
    "following": 0,
    "is_followed": false,
    "local_time": null,
    "last_sign_in_at": "2022-09-05T04:19:05.966Z",
    "confirmed_at": "2022-09-05T04:19:04.485Z",
    "last_activity_on": "2022-09-08",
    "email": "test@jihulab.com",
    "theme_id": 1,
    "color_scheme_id": 1,
    "projects_limit": 100000,
    "current_sign_in_at": "2022-09-08T02:30:36.984Z",
    "identities": [
        {
            "provider": "github",
            "extern_uid": "99999999",
            "saml_provider_id": null
        }
    ],
    "can_create_group": true,
    "can_create_project": true,
    "two_factor_enabled": false,
    "external": false,
    "private_profile": false,
    "commit_email": "test@jihulab.com",
    "shared_runners_minutes_limit": null,
    "extra_shared_runners_minutes_limit": null,
    "phone": "12"
}

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

JH SaaS

  1. When it is JH SaaS
  2. Then you should see phone

NOT JH SaaS

  1. When it is NOT JH SaaS
  2. Then you should NOT see phone

Permission check

  1. Request that API
  2. Then you should see phone of your self, not others

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Closes #1717 (closed)

Martin Tan 编辑于

合并请求报告

加载中