Skip to content

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

Screen_Shot_2018-07-06_at_16.52.06

Old layout but with correct placeholder messages:

Screen_Shot_2018-06-07_at_11.21.07

Screen_Shot_2018-06-07_at_11.20.58

Validation error example:

Screen_Shot_2018-03-19_at_15.42.19

Warning when external checkbox is changed:

Screen_Shot_2018-06-07_at_11.21.36

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Edited by Phil Hughes

Merge request reports