Skip to content

Resolve "针对跨国主体的新发展银行使用SaaS时无需进行手机实名制验证的需求"

奇廷 陈请求将 qt/gitlab:2047-confidential-issue合并到main-jh

Related issue: https://jihulab.com/gitlab-cn/gitlab/-/issues/2047

What does this MR do and why?

Modify the SaaS-related code logic to allow specific groups to connect to third-party SSO without mandatory real-name verification.

  • Add a long-lived feature flag: skip_real_name_verification to disable real-name verification.
  • Update User#phone_verified? to let disabled real-name verification group members's phone_verified? return true.
  • Disabled real-name verification group members do not need to do phone_verify.
  • Disabled real-name verification group members are allowed to access via API and Git.
  • Update user profile front and backend logic.
  • Disabled real-name verification group members are allowed to set phone to be empty or bind a specific phone number in front form layer.

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

  1. Enable real-name authentication.
# 1. saas 
export GITLAB_SIMULATE_SAAS=1
gdk restart

# 2. Enable real-name authentication configuration
# rails console
a=ApplicationSetting.first
a.phone_verification_code_enabled=true
a.save

# test
::Gitlab::RealNameSystem.enabled?
  1. Select a group to disable real-name authentication.
# rails console
group = User.first.groups[0]
Feature.enable :skip_real_name_verification, group

# test
Feature.enabled? :skip_real_name_verification, group, type: :ops
  1. Select a member without real-name authentication who is from the disabled real-name authentication group, and log in.
  • No mandatory real-name authentication:

image-20221229160757504

  • Edit profile: the phone number is allowed to be empty: image-20221229161122298
  • Access api: /api/v4/issues?scope=all: image-20221229161532657
  • git clone private project:
git clone ssh://git@127.0.0.1:2222/root/issue-1522-test-t.git
正克隆到 'issue-1522-test-t'...
remote: Enumerating objects: 21, done.
remote: Counting objects: 100% (21/21), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 21 (delta 4), reused 0 (delta 0), pack-reused 0
接收对象中: 100% (21/21), 4.61 KiB | 4.61 MiB/s, 完成.
处理 delta 中: 100% (4/4), 完成.
  1. Select a member without real-name verification who is not from the disabled real-name verification group, and log in. This user will need real-name verification. image
  2. Select a member with real-name verification, and login in. This user's phone number will not be allowed to be empty. image

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 #2047

Baodong 编辑于

合并请求报告

加载中