Add rate limit for member invite via email
What does this MR do and why?
Relate issue https://jihulab.com/gitlab-cn/gitlab/-/issues/4086
为「通过邮箱邀请用户」这件事加上频次限制:每个用户每天只能邀请 50 个邮箱。
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
After:
How to set up and validate locally
-
打开 FF
Feature.enable(:ff_invitation_email_rate_limit)
-
使用邮箱邀请用户:进入任一项目邀请,或通过 API 邀请:
curl --location 'http://127.0.0.1:3000/api/v4/projects/{id}/invitations' \ --header 'PRIVATE-TOKEN: xxx' \ --header 'Content-Type: application/json' \ --form 'access_level="30"' \ --form 'email="1@example.com,2@example.com"'
-
期待效果:邀请的前 50 个用户可以邀请成功,超过 50 后失败
由 路志远 编辑于