Allow whitelisting for "external collaborator by default" setting
What does this MR do?
We would like to extend the "add new users as external by default" function with a new input field "add as internal collaborators" which is a text input field, allowing to pass a regular expression, which adds all matching email addresses as internal collaborators rather than external collaborators.
added to UI in admin/users/new and create user by API.
Are there points in the code the reviewer needs to double check?
Validation of regex in admin/application_settings/ form
Validation of the regex is done by checking if it is possible to convert the ruby Regexp to a javascript regex by creating a JsRegex (js_regex gem) from the ruby Regexp. The js_regex gem is used to generate a javascript regex for admin/users/new already.
(For the API create of a new user, a ruby regex is used.) Since not all ruby regexes can be converted 1 to 1 to javascript, the warnings outputed could be used to validate the regex when an administrator tries to save it, so only javascript compatible regexes could be saved.
Why was this MR needed?
Situation now:
GitLab allows to treat all new users as external collaborators when using the "add new users as external collaborators" settings in the admin panel. Such external collaborator don't have access to internal projects. Converting a user from external to internal has to be done manually or by utilizing the API.
Added functionality:
However, adding all new users as external collaborators and only allow certain people internal access (e.g. employees) based on certain criteria (e.g. email address) is a quiet common use case.
The development of this MR is sponsored by @ siemens (/cc @bufferoverflow @koffeinfrei).
Screenshots (if relevant)
New layout, with section titles in the page
Old layout but with correct placeholder messages:
Validation error example:
Warning when external checkbox is changed:
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added -
Tests added for this feature/bug - Review
-
Has been reviewed by UX -
Has been reviewed by Frontend -
Has been reviewed by Backend -
Has been reviewed by Database
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Squashed related commits together -
Internationalization required/considered -
End-to-end tests pass ( package-qa
manual pipeline job)