Commit c9375914 authored by George Koltsov's avatar George Koltsov

Update Import/Export to use public email when mapping users

Changelog: security
EE: true
parent 7f1b6ac9
...@@ -259,7 +259,7 @@ Only include the following attributes for the models specified: ...@@ -259,7 +259,7 @@ Only include the following attributes for the models specified:
included_attributes: included_attributes:
user: user:
- :id - :id
- :email - :public_email
# ... # ...
``` ```
......
...@@ -44,7 +44,7 @@ Note the following: ...@@ -44,7 +44,7 @@ Note the following:
- Group members are exported as project members, as long as the user has - Group members are exported as project members, as long as the user has
a maintainer or administrator role in the group where the exported project lives. a maintainer or administrator role in the group where the exported project lives.
- Project members with the [Owner role](../../permissions.md) are imported as Maintainers. - Project members with the [Owner role](../../permissions.md) are imported as Maintainers.
- Imported users can be mapped by their primary email on self-managed instances, if an administrative user (not an owner) does the import. - Imported users can be mapped by their public email on self-managed instances, if an administrative user (not an owner) does the import.
Additionally, the user must be an existing member of the namespace, or the user can be added as a Additionally, the user must be an existing member of the namespace, or the user can be added as a
member of the project for contributions to be mapped. member of the project for contributions to be mapped.
Otherwise, a supplementary comment is left to mention that the original author and Otherwise, a supplementary comment is left to mention that the original author and
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"requested_at": null, "requested_at": null,
"user": { "user": {
"id": 16, "id": 16,
"email": "bernard_willms@gitlabexample.com", "public_email": "bernard_willms@gitlabexample.com",
"username": "bernard_willms" "username": "bernard_willms"
} }
} }
......
...@@ -204,7 +204,7 @@ ...@@ -204,7 +204,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 42, "id": 42,
"email": "moriah@collinsmurphy.com", "public_email": "moriah@collinsmurphy.com",
"username": "reported_user_15" "username": "reported_user_15"
} }
} }
...@@ -433,7 +433,7 @@ ...@@ -433,7 +433,7 @@
}, },
"author": { "author": {
"id": 1, "id": 1,
"email": "", "public_email": "",
"created_at": "2021-04-14T14:42:15.926Z", "created_at": "2021-04-14T14:42:15.926Z",
"updated_at": "2021-06-08T16:32:26.109Z", "updated_at": "2021-06-08T16:32:26.109Z",
"name": "Administrator" "name": "Administrator"
......
{"id":13766,"access_level":30,"source_id":4351,"source_type":"Namespace","user_id":42,"notification_level":3,"created_at":"2019-11-20T17:04:36.184Z","updated_at":"2019-11-20T17:04:36.184Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":42,"email":"moriah@collinsmurphy.com","username":"reported_user_15"}} {"id":13766,"access_level":30,"source_id":4351,"source_type":"Namespace","user_id":42,"notification_level":3,"created_at":"2019-11-20T17:04:36.184Z","updated_at":"2019-11-20T17:04:36.184Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":42,"public_email":"moriah@collinsmurphy.com","username":"reported_user_15"}}
...@@ -20,7 +20,7 @@ tree: ...@@ -20,7 +20,7 @@ tree:
included_attributes: included_attributes:
user: user:
- :id - :id
- :email - :public_email
- :username - :username
author: author:
- :name - :name
......
...@@ -20,7 +20,7 @@ tree: ...@@ -20,7 +20,7 @@ tree:
included_attributes: included_attributes:
user: user:
- :id - :id
- :email - :public_email
- :username - :username
author: author:
- :name - :name
......
...@@ -19,7 +19,8 @@ module Gitlab ...@@ -19,7 +19,8 @@ module Gitlab
@exported_members.inject(missing_keys_tracking_hash) do |hash, member| @exported_members.inject(missing_keys_tracking_hash) do |hash, member|
if member['user'] if member['user']
old_user_id = member['user']['id'] old_user_id = member['user']['id']
existing_user = User.find_by(find_user_query(member)) old_user_email = member.dig('user', 'public_email') || member.dig('user', 'email')
existing_user = User.find_by(find_user_query(old_user_email)) if old_user_email
hash[old_user_id] = existing_user.id if existing_user && add_team_member(member, existing_user) hash[old_user_id] = existing_user.id if existing_user && add_team_member(member, existing_user)
else else
add_team_member(member) add_team_member(member)
...@@ -94,8 +95,8 @@ module Gitlab ...@@ -94,8 +95,8 @@ module Gitlab
relation_class: relation_class) relation_class: relation_class)
end end
def find_user_query(member) def find_user_query(email)
user_arel[:email].eq(member['user']['email']) user_arel[:email].eq(email)
end end
def user_arel def user_arel
......
...@@ -114,7 +114,7 @@ tree: ...@@ -114,7 +114,7 @@ tree:
included_attributes: included_attributes:
user: user:
- :id - :id
- :email - :public_email
- :username - :username
author: author:
- :name - :name
......
This diff is collapsed.
...@@ -2398,7 +2398,7 @@ ...@@ -2398,7 +2398,7 @@
"requested_at": null, "requested_at": null,
"user": { "user": {
"id": 16, "id": 16,
"email": "bernard_willms@gitlabexample.com", "public_email": "bernard_willms@gitlabexample.com",
"username": "bernard_willms" "username": "bernard_willms"
} }
}, },
...@@ -2418,7 +2418,7 @@ ...@@ -2418,7 +2418,7 @@
"requested_at": null, "requested_at": null,
"user": { "user": {
"id": 6, "id": 6,
"email": "saul_will@gitlabexample.com", "public_email": "saul_will@gitlabexample.com",
"username": "saul_will" "username": "saul_will"
} }
}, },
...@@ -2438,7 +2438,7 @@ ...@@ -2438,7 +2438,7 @@
"requested_at": null, "requested_at": null,
"user": { "user": {
"id": 15, "id": 15,
"email": "breanna_sanford@wolf.com", "public_email": "breanna_sanford@wolf.com",
"username": "emmet.schamberger" "username": "emmet.schamberger"
} }
}, },
...@@ -2458,7 +2458,7 @@ ...@@ -2458,7 +2458,7 @@
"requested_at": null, "requested_at": null,
"user": { "user": {
"id": 26, "id": 26,
"email": "user4@example.com", "public_email": "user4@example.com",
"username": "user4" "username": "user4"
} }
} }
......
{"id":36,"access_level":40,"source_id":5,"source_type":"Project","user_id":16,"notification_level":3,"created_at":"2016-06-14T15:02:03.834Z","updated_at":"2016-06-14T15:02:03.834Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"user":{"id":16,"email":"bernard_willms@gitlabexample.com","username":"bernard_willms"}} {"id":36,"access_level":40,"source_id":5,"source_type":"Project","user_id":16,"notification_level":3,"created_at":"2016-06-14T15:02:03.834Z","updated_at":"2016-06-14T15:02:03.834Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"user":{"id":16,"public_email":"bernard_willms@gitlabexample.com","username":"bernard_willms"}}
{"id":35,"access_level":10,"source_id":5,"source_type":"Project","user_id":6,"notification_level":3,"created_at":"2016-06-14T15:02:03.811Z","updated_at":"2016-06-14T15:02:03.811Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"user":{"id":6,"email":"saul_will@gitlabexample.com","username":"saul_will"}} {"id":35,"access_level":10,"source_id":5,"source_type":"Project","user_id":6,"notification_level":3,"created_at":"2016-06-14T15:02:03.811Z","updated_at":"2016-06-14T15:02:03.811Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"user":{"id":6,"public_email":"saul_will@gitlabexample.com","username":"saul_will"}}
{"id":34,"access_level":20,"source_id":5,"source_type":"Project","user_id":15,"notification_level":3,"created_at":"2016-06-14T15:02:03.776Z","updated_at":"2016-06-14T15:02:03.776Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"user":{"id":15,"email":"breanna_sanford@wolf.com","username":"emmet.schamberger"}} {"id":34,"access_level":20,"source_id":5,"source_type":"Project","user_id":15,"notification_level":3,"created_at":"2016-06-14T15:02:03.776Z","updated_at":"2016-06-14T15:02:03.776Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"user":{"id":15,"public_email":"breanna_sanford@wolf.com","username":"emmet.schamberger"}}
{"id":33,"access_level":20,"source_id":5,"source_type":"Project","user_id":26,"notification_level":3,"created_at":"2016-06-14T15:02:03.742Z","updated_at":"2016-06-14T15:02:03.742Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"user":{"id":26,"email":"user4@example.com","username":"user4"}} {"id":33,"access_level":20,"source_id":5,"source_type":"Project","user_id":26,"notification_level":3,"created_at":"2016-06-14T15:02:03.742Z","updated_at":"2016-06-14T15:02:03.742Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"user":{"id":26,"public_email":"user4@example.com","username":"user4"}}
...@@ -425,7 +425,7 @@ ...@@ -425,7 +425,7 @@
"override":false, "override":false,
"user":{ "user":{
"id":1, "id":1,
"email":"admin@example.com", "public_email":"admin@example.com",
"username":"root" "username":"root"
} }
}, },
...@@ -448,7 +448,7 @@ ...@@ -448,7 +448,7 @@
"override":false, "override":false,
"user":{ "user":{
"id":2, "id":2,
"email":"user_2@gitlabexample.com", "public_email":"user_2@gitlabexample.com",
"username":"user_2" "username":"user_2"
} }
} }
......
...@@ -377,7 +377,7 @@ ...@@ -377,7 +377,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 42, "id": 42,
"email": "moriah@collinsmurphy.com", "public_email": "moriah@collinsmurphy.com",
"username": "reported_user_15" "username": "reported_user_15"
} }
}, },
...@@ -400,7 +400,7 @@ ...@@ -400,7 +400,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 271, "id": 271,
"email": "garret@connellystark.ca", "public_email": "garret@connellystark.ca",
"username": "charlesetta" "username": "charlesetta"
} }
}, },
...@@ -423,7 +423,7 @@ ...@@ -423,7 +423,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 206, "id": 206,
"email": "gwendolyn_robel@gitlabexample.com", "public_email": "gwendolyn_robel@gitlabexample.com",
"username": "gwendolyn_robel" "username": "gwendolyn_robel"
} }
}, },
...@@ -446,7 +446,7 @@ ...@@ -446,7 +446,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 39, "id": 39,
"email": "alexis_berge@kerlukeklein.us", "public_email": "alexis_berge@kerlukeklein.us",
"username": "reported_user_12" "username": "reported_user_12"
} }
}, },
...@@ -469,7 +469,7 @@ ...@@ -469,7 +469,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 1624, "id": 1624,
"email": "adriene.mcclure@gitlabexample.com", "public_email": "adriene.mcclure@gitlabexample.com",
"username": "adriene.mcclure" "username": "adriene.mcclure"
} }
}, },
...@@ -492,7 +492,7 @@ ...@@ -492,7 +492,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 1, "id": 1,
"email": "admin@example.com", "public_email": "admin@example.com",
"username": "root" "username": "root"
} }
} }
...@@ -1338,7 +1338,7 @@ ...@@ -1338,7 +1338,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 1087, "id": 1087,
"email": "paige@blanda.info", "public_email": "paige@blanda.info",
"username": "billi_auer" "username": "billi_auer"
} }
}, },
...@@ -1361,7 +1361,7 @@ ...@@ -1361,7 +1361,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 171, "id": 171,
"email": "heidi@bosco.co.uk", "public_email": "heidi@bosco.co.uk",
"username": "gerard.cruickshank" "username": "gerard.cruickshank"
} }
}, },
...@@ -1384,7 +1384,7 @@ ...@@ -1384,7 +1384,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 1157, "id": 1157,
"email": "larisa.bruen@carroll.biz", "public_email": "larisa.bruen@carroll.biz",
"username": "milagros.reynolds" "username": "milagros.reynolds"
} }
}, },
...@@ -1407,7 +1407,7 @@ ...@@ -1407,7 +1407,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 14, "id": 14,
"email": "madlyn_kovacek@wiza.ca", "public_email": "madlyn_kovacek@wiza.ca",
"username": "monique.gusikowski" "username": "monique.gusikowski"
} }
}, },
...@@ -1430,7 +1430,7 @@ ...@@ -1430,7 +1430,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 1167, "id": 1167,
"email": "mirella@koepp.ca", "public_email": "mirella@koepp.ca",
"username": "eileen" "username": "eileen"
} }
}, },
...@@ -1453,7 +1453,7 @@ ...@@ -1453,7 +1453,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 1, "id": 1,
"email": "admin@example.com", "public_email": "admin@example.com",
"username": "root" "username": "root"
} }
} }
...@@ -1909,7 +1909,7 @@ ...@@ -1909,7 +1909,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 1533, "id": 1533,
"email": "jose@cassin.ca", "public_email": "jose@cassin.ca",
"username": "buster" "username": "buster"
} }
}, },
...@@ -1932,7 +1932,7 @@ ...@@ -1932,7 +1932,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 1586, "id": 1586,
"email": "carie@gleichner.us", "public_email": "carie@gleichner.us",
"username": "dominque" "username": "dominque"
} }
}, },
...@@ -1955,7 +1955,7 @@ ...@@ -1955,7 +1955,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 190, "id": 190,
"email": "delois@funk.biz", "public_email": "delois@funk.biz",
"username": "kittie" "username": "kittie"
} }
}, },
...@@ -1978,7 +1978,7 @@ ...@@ -1978,7 +1978,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 254, "id": 254,
"email": "tyra.lowe@whitemckenzie.co.uk", "public_email": "tyra.lowe@whitemckenzie.co.uk",
"username": "kassie" "username": "kassie"
} }
}, },
...@@ -2001,7 +2001,7 @@ ...@@ -2001,7 +2001,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 503, "id": 503,
"email": "tyesha.brakus@bruen.ca", "public_email": "tyesha.brakus@bruen.ca",
"username": "charise" "username": "charise"
} }
}, },
...@@ -2024,7 +2024,7 @@ ...@@ -2024,7 +2024,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 1, "id": 1,
"email": "admin@example.com", "public_email": "admin@example.com",
"username": "root" "username": "root"
} }
} }
......
{"id":13766,"access_level":30,"source_id":4351,"source_type":"Namespace","user_id":42,"notification_level":3,"created_at":"2019-11-20T17:04:36.184Z","updated_at":"2019-11-20T17:04:36.184Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":42,"email":"moriah@collinsmurphy.com","username":"reported_user_15"}} {"id":13766,"access_level":30,"source_id":4351,"source_type":"Namespace","user_id":42,"notification_level":3,"created_at":"2019-11-20T17:04:36.184Z","updated_at":"2019-11-20T17:04:36.184Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":42,"public_email":"moriah@collinsmurphy.com","username":"reported_user_15"}}
{"id":13765,"access_level":40,"source_id":4351,"source_type":"Namespace","user_id":271,"notification_level":3,"created_at":"2019-11-20T17:04:36.044Z","updated_at":"2019-11-20T17:04:36.044Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":271,"email":"garret@connellystark.ca","username":"charlesetta"}} {"id":13765,"access_level":40,"source_id":4351,"source_type":"Namespace","user_id":271,"notification_level":3,"created_at":"2019-11-20T17:04:36.044Z","updated_at":"2019-11-20T17:04:36.044Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":271,"public_email":"garret@connellystark.ca","username":"charlesetta"}}
{"id":13764,"access_level":30,"source_id":4351,"source_type":"Namespace","user_id":206,"notification_level":3,"created_at":"2019-11-20T17:04:35.840Z","updated_at":"2019-11-20T17:04:35.840Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":206,"email":"gwendolyn_robel@gitlabexample.com","username":"gwendolyn_robel"}} {"id":13764,"access_level":30,"source_id":4351,"source_type":"Namespace","user_id":206,"notification_level":3,"created_at":"2019-11-20T17:04:35.840Z","updated_at":"2019-11-20T17:04:35.840Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":206,"public_email":"gwendolyn_robel@gitlabexample.com","username":"gwendolyn_robel"}}
{"id":13763,"access_level":10,"source_id":4351,"source_type":"Namespace","user_id":39,"notification_level":3,"created_at":"2019-11-20T17:04:35.704Z","updated_at":"2019-11-20T17:04:35.704Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":39,"email":"alexis_berge@kerlukeklein.us","username":"reported_user_12"}} {"id":13763,"access_level":10,"source_id":4351,"source_type":"Namespace","user_id":39,"notification_level":3,"created_at":"2019-11-20T17:04:35.704Z","updated_at":"2019-11-20T17:04:35.704Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":39,"public_email":"alexis_berge@kerlukeklein.us","username":"reported_user_12"}}
{"id":13762,"access_level":20,"source_id":4351,"source_type":"Namespace","user_id":1624,"notification_level":3,"created_at":"2019-11-20T17:04:35.566Z","updated_at":"2019-11-20T17:04:35.566Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1624,"email":"adriene.mcclure@gitlabexample.com","username":"adriene.mcclure"}} {"id":13762,"access_level":20,"source_id":4351,"source_type":"Namespace","user_id":1624,"notification_level":3,"created_at":"2019-11-20T17:04:35.566Z","updated_at":"2019-11-20T17:04:35.566Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1624,"public_email":"adriene.mcclure@gitlabexample.com","username":"adriene.mcclure"}}
{"id":12920,"access_level":50,"source_id":4351,"source_type":"Namespace","user_id":1,"notification_level":3,"created_at":"2019-11-20T17:01:53.505Z","updated_at":"2019-11-20T17:01:53.505Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1,"email":"admin@example.com","username":"root"}} {"id":12920,"access_level":50,"source_id":4351,"source_type":"Namespace","user_id":1,"notification_level":3,"created_at":"2019-11-20T17:01:53.505Z","updated_at":"2019-11-20T17:01:53.505Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1,"public_email":"admin@example.com","username":"root"}}
{"id":13771,"access_level":30,"source_id":4352,"source_type":"Namespace","user_id":1087,"notification_level":3,"created_at":"2019-11-20T17:04:36.968Z","updated_at":"2019-11-20T17:04:36.968Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1087,"email":"paige@blanda.info","username":"billi_auer"}} {"id":13771,"access_level":30,"source_id":4352,"source_type":"Namespace","user_id":1087,"notification_level":3,"created_at":"2019-11-20T17:04:36.968Z","updated_at":"2019-11-20T17:04:36.968Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1087,"public_email":"paige@blanda.info","username":"billi_auer"}}
{"id":13770,"access_level":20,"source_id":4352,"source_type":"Namespace","user_id":171,"notification_level":3,"created_at":"2019-11-20T17:04:36.821Z","updated_at":"2019-11-20T17:04:36.821Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":171,"email":"heidi@bosco.co.uk","username":"gerard.cruickshank"}} {"id":13770,"access_level":20,"source_id":4352,"source_type":"Namespace","user_id":171,"notification_level":3,"created_at":"2019-11-20T17:04:36.821Z","updated_at":"2019-11-20T17:04:36.821Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":171,"public_email":"heidi@bosco.co.uk","username":"gerard.cruickshank"}}
{"id":13769,"access_level":30,"source_id":4352,"source_type":"Namespace","user_id":1157,"notification_level":3,"created_at":"2019-11-20T17:04:36.606Z","updated_at":"2019-11-20T17:04:36.606Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1157,"email":"larisa.bruen@carroll.biz","username":"milagros.reynolds"}} {"id":13769,"access_level":30,"source_id":4352,"source_type":"Namespace","user_id":1157,"notification_level":3,"created_at":"2019-11-20T17:04:36.606Z","updated_at":"2019-11-20T17:04:36.606Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1157,"public_email":"larisa.bruen@carroll.biz","username":"milagros.reynolds"}}
{"id":13768,"access_level":40,"source_id":4352,"source_type":"Namespace","user_id":14,"notification_level":3,"created_at":"2019-11-20T17:04:36.465Z","updated_at":"2019-11-20T17:04:36.465Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":14,"email":"madlyn_kovacek@wiza.ca","username":"monique.gusikowski"}} {"id":13768,"access_level":40,"source_id":4352,"source_type":"Namespace","user_id":14,"notification_level":3,"created_at":"2019-11-20T17:04:36.465Z","updated_at":"2019-11-20T17:04:36.465Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":14,"public_email":"madlyn_kovacek@wiza.ca","username":"monique.gusikowski"}}
{"id":13767,"access_level":10,"source_id":4352,"source_type":"Namespace","user_id":1167,"notification_level":3,"created_at":"2019-11-20T17:04:36.324Z","updated_at":"2019-11-20T17:04:36.324Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1167,"email":"mirella@koepp.ca","username":"eileen"}} {"id":13767,"access_level":10,"source_id":4352,"source_type":"Namespace","user_id":1167,"notification_level":3,"created_at":"2019-11-20T17:04:36.324Z","updated_at":"2019-11-20T17:04:36.324Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1167,"public_email":"mirella@koepp.ca","username":"eileen"}}
{"id":12921,"access_level":50,"source_id":4352,"source_type":"Namespace","user_id":1,"notification_level":3,"created_at":"2019-11-20T17:01:53.953Z","updated_at":"2019-11-20T17:01:53.953Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1,"email":"admin@example.com","username":"root"}} {"id":12921,"access_level":50,"source_id":4352,"source_type":"Namespace","user_id":1,"notification_level":3,"created_at":"2019-11-20T17:01:53.953Z","updated_at":"2019-11-20T17:01:53.953Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1,"public_email":"admin@example.com","username":"root"}}
{"id":13786,"access_level":30,"source_id":4355,"source_type":"Namespace","user_id":1533,"notification_level":3,"created_at":"2019-11-20T17:04:39.405Z","updated_at":"2019-11-20T17:04:39.405Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1533,"email":"jose@cassin.ca","username":"buster"}} {"id":13786,"access_level":30,"source_id":4355,"source_type":"Namespace","user_id":1533,"notification_level":3,"created_at":"2019-11-20T17:04:39.405Z","updated_at":"2019-11-20T17:04:39.405Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1533,"public_email":"jose@cassin.ca","username":"buster"}}
{"id":13785,"access_level":10,"source_id":4355,"source_type":"Namespace","user_id":1586,"notification_level":3,"created_at":"2019-11-20T17:04:39.269Z","updated_at":"2019-11-20T17:04:39.269Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1586,"email":"carie@gleichner.us","username":"dominque"}} {"id":13785,"access_level":10,"source_id":4355,"source_type":"Namespace","user_id":1586,"notification_level":3,"created_at":"2019-11-20T17:04:39.269Z","updated_at":"2019-11-20T17:04:39.269Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1586,"public_email":"carie@gleichner.us","username":"dominque"}}
{"id":13784,"access_level":30,"source_id":4355,"source_type":"Namespace","user_id":190,"notification_level":3,"created_at":"2019-11-20T17:04:39.127Z","updated_at":"2019-11-20T17:04:39.127Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":190,"email":"delois@funk.biz","username":"kittie"}} {"id":13784,"access_level":30,"source_id":4355,"source_type":"Namespace","user_id":190,"notification_level":3,"created_at":"2019-11-20T17:04:39.127Z","updated_at":"2019-11-20T17:04:39.127Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":190,"public_email":"delois@funk.biz","username":"kittie"}}
{"id":13783,"access_level":20,"source_id":4355,"source_type":"Namespace","user_id":254,"notification_level":3,"created_at":"2019-11-20T17:04:38.971Z","updated_at":"2019-11-20T17:04:38.971Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":254,"email":"tyra.lowe@whitemckenzie.co.uk","username":"kassie"}} {"id":13783,"access_level":20,"source_id":4355,"source_type":"Namespace","user_id":254,"notification_level":3,"created_at":"2019-11-20T17:04:38.971Z","updated_at":"2019-11-20T17:04:38.971Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":254,"public_email":"tyra.lowe@whitemckenzie.co.uk","username":"kassie"}}
{"id":13782,"access_level":40,"source_id":4355,"source_type":"Namespace","user_id":503,"notification_level":3,"created_at":"2019-11-20T17:04:38.743Z","updated_at":"2019-11-20T17:04:38.743Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":503,"email":"tyesha.brakus@bruen.ca","username":"charise"}} {"id":13782,"access_level":40,"source_id":4355,"source_type":"Namespace","user_id":503,"notification_level":3,"created_at":"2019-11-20T17:04:38.743Z","updated_at":"2019-11-20T17:04:38.743Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":503,"public_email":"tyesha.brakus@bruen.ca","username":"charise"}}
{"id":12924,"access_level":50,"source_id":4355,"source_type":"Namespace","user_id":1,"notification_level":3,"created_at":"2019-11-20T17:01:54.145Z","updated_at":"2019-11-20T17:01:54.145Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1,"email":"admin@example.com","username":"root"}} {"id":12924,"access_level":50,"source_id":4355,"source_type":"Namespace","user_id":1,"notification_level":3,"created_at":"2019-11-20T17:01:54.145Z","updated_at":"2019-11-20T17:01:54.145Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1,"public_email":"admin@example.com","username":"root"}}
...@@ -299,7 +299,7 @@ ...@@ -299,7 +299,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 42, "id": 42,
"email": "moriah@collinsmurphy.com", "public_email": "moriah@collinsmurphy.com",
"username": "reported_user_15" "username": "reported_user_15"
} }
}, },
...@@ -322,7 +322,7 @@ ...@@ -322,7 +322,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 271, "id": 271,
"email": "garret@connellystark.ca", "public_email": "garret@connellystark.ca",
"username": "charlesetta" "username": "charlesetta"
} }
}, },
...@@ -345,7 +345,7 @@ ...@@ -345,7 +345,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 206, "id": 206,
"email": "margaret.bergnaum@reynolds.us", "public_email": "margaret.bergnaum@reynolds.us",
"username": "gwendolyn_robel" "username": "gwendolyn_robel"
} }
}, },
...@@ -368,7 +368,7 @@ ...@@ -368,7 +368,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 39, "id": 39,
"email": "alexis_berge@kerlukeklein.us", "public_email": "alexis_berge@kerlukeklein.us",
"username": "reported_user_12" "username": "reported_user_12"
} }
}, },
...@@ -391,7 +391,7 @@ ...@@ -391,7 +391,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 1624, "id": 1624,
"email": "nakesha.herzog@powlowski.com", "public_email": "nakesha.herzog@powlowski.com",
"username": "adriene.mcclure" "username": "adriene.mcclure"
} }
}, },
...@@ -414,7 +414,7 @@ ...@@ -414,7 +414,7 @@
"override": false, "override": false,
"user": { "user": {
"id": 1, "id": 1,
"email": "admin@example.com", "public_email": "admin@example.com",
"username": "root" "username": "root"
} }
} }
......
{"id":13766,"access_level":30,"source_id":4351,"source_type":"Namespace","user_id":42,"notification_level":3,"created_at":"2019-11-20T17:04:36.184Z","updated_at":"2019-11-20T17:04:36.184Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":42,"email":"moriah@collinsmurphy.com","username":"reported_user_15"}} {"id":13766,"access_level":30,"source_id":4351,"source_type":"Namespace","user_id":42,"notification_level":3,"created_at":"2019-11-20T17:04:36.184Z","updated_at":"2019-11-20T17:04:36.184Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":42,"public_email":"moriah@collinsmurphy.com","username":"reported_user_15"}}
{"id":13765,"access_level":40,"source_id":4351,"source_type":"Namespace","user_id":271,"notification_level":3,"created_at":"2019-11-20T17:04:36.044Z","updated_at":"2019-11-20T17:04:36.044Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":271,"email":"garret@connellystark.ca","username":"charlesetta"}} {"id":13765,"access_level":40,"source_id":4351,"source_type":"Namespace","user_id":271,"notification_level":3,"created_at":"2019-11-20T17:04:36.044Z","updated_at":"2019-11-20T17:04:36.044Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":271,"public_email":"garret@connellystark.ca","username":"charlesetta"}}
{"id":13764,"access_level":30,"source_id":4351,"source_type":"Namespace","user_id":206,"notification_level":3,"created_at":"2019-11-20T17:04:35.840Z","updated_at":"2019-11-20T17:04:35.840Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":206,"email":"margaret.bergnaum@reynolds.us","username":"gwendolyn_robel"}} {"id":13764,"access_level":30,"source_id":4351,"source_type":"Namespace","user_id":206,"notification_level":3,"created_at":"2019-11-20T17:04:35.840Z","updated_at":"2019-11-20T17:04:35.840Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":206,"public_email":"margaret.bergnaum@reynolds.us","username":"gwendolyn_robel"}}
{"id":13763,"access_level":10,"source_id":4351,"source_type":"Namespace","user_id":39,"notification_level":3,"created_at":"2019-11-20T17:04:35.704Z","updated_at":"2019-11-20T17:04:35.704Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":39,"email":"alexis_berge@kerlukeklein.us","username":"reported_user_12"}} {"id":13763,"access_level":10,"source_id":4351,"source_type":"Namespace","user_id":39,"notification_level":3,"created_at":"2019-11-20T17:04:35.704Z","updated_at":"2019-11-20T17:04:35.704Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":39,"public_email":"alexis_berge@kerlukeklein.us","username":"reported_user_12"}}
{"id":13762,"access_level":20,"source_id":4351,"source_type":"Namespace","user_id":1624,"notification_level":3,"created_at":"2019-11-20T17:04:35.566Z","updated_at":"2019-11-20T17:04:35.566Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1624,"email":"nakesha.herzog@powlowski.com","username":"adriene.mcclure"}} {"id":13762,"access_level":20,"source_id":4351,"source_type":"Namespace","user_id":1624,"notification_level":3,"created_at":"2019-11-20T17:04:35.566Z","updated_at":"2019-11-20T17:04:35.566Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1624,"public_email":"nakesha.herzog@powlowski.com","username":"adriene.mcclure"}}
{"id":12920,"access_level":50,"source_id":4351,"source_type":"Namespace","user_id":1,"notification_level":3,"created_at":"2019-11-20T17:01:53.505Z","updated_at":"2019-11-20T17:01:53.505Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1,"email":"admin@example.com","username":"root"}} {"id":12920,"access_level":50,"source_id":4351,"source_type":"Namespace","user_id":1,"notification_level":3,"created_at":"2019-11-20T17:01:53.505Z","updated_at":"2019-11-20T17:01:53.505Z","created_by_id":null,"invite_email":null,"invite_token":null,"invite_accepted_at":null,"requested_at":null,"expires_at":null,"ldap":false,"override":false,"user":{"id":1,"public_email":"admin@example.com","username":"root"}}
...@@ -102,7 +102,7 @@ RSpec.describe Gitlab::ImportExport::Base::RelationFactory do ...@@ -102,7 +102,7 @@ RSpec.describe Gitlab::ImportExport::Base::RelationFactory do
"updated_at" => "2016-11-18T09:29:42.634Z", "updated_at" => "2016-11-18T09:29:42.634Z",
"user" => { "user" => {
"id" => 999, "id" => 999,
"email" => new_user.email, "public_email" => new_user.email,
"username" => new_user.username "username" => new_user.username
} }
} }
......
...@@ -83,11 +83,12 @@ RSpec.describe Gitlab::ImportExport::Group::LegacyTreeSaver do ...@@ -83,11 +83,12 @@ RSpec.describe Gitlab::ImportExport::Group::LegacyTreeSaver do
let(:user2) { create(:user, email: 'group@member.com') } let(:user2) { create(:user, email: 'group@member.com') }
let(:member_emails) do let(:member_emails) do
saved_group_json['members'].map do |pm| saved_group_json['members'].map do |pm|
pm['user']['email'] pm['user']['public_email']
end end
end end
before do before do
user2.update(public_email: user2.email)
group.add_developer(user2) group.add_developer(user2)
end end
......
...@@ -24,7 +24,7 @@ RSpec.describe Gitlab::ImportExport::MembersMapper do ...@@ -24,7 +24,7 @@ RSpec.describe Gitlab::ImportExport::MembersMapper do
"user" => "user" =>
{ {
"id" => exported_user_id, "id" => exported_user_id,
"email" => user2.email, "public_email" => user2.email,
"username" => 'test' "username" => 'test'
}, },
"user_id" => 19 "user_id" => 19
...@@ -122,7 +122,7 @@ RSpec.describe Gitlab::ImportExport::MembersMapper do ...@@ -122,7 +122,7 @@ RSpec.describe Gitlab::ImportExport::MembersMapper do
"user" => "user" =>
{ {
"id" => exported_user_id, "id" => exported_user_id,
"email" => user2.email, "public_email" => user2.email,
"username" => 'test' "username" => 'test'
}, },
"user_id" => 19 "user_id" => 19
...@@ -157,6 +157,37 @@ RSpec.describe Gitlab::ImportExport::MembersMapper do ...@@ -157,6 +157,37 @@ RSpec.describe Gitlab::ImportExport::MembersMapper do
expect(members_mapper.map[exported_user_id]).to eq(user2.id) expect(members_mapper.map[exported_user_id]).to eq(user2.id)
end end
end end
context 'when user has email exported' do
let(:exported_members) do
[
{
"id" => 2,
"access_level" => 40,
"source_id" => 14,
"source_type" => source_type,
"notification_level" => 3,
"created_at" => "2016-03-11T10:21:44.822Z",
"updated_at" => "2016-03-11T10:21:44.822Z",
"created_by_id" => nil,
"invite_email" => nil,
"invite_token" => nil,
"invite_accepted_at" => nil,
"user" =>
{
"id" => exported_user_id,
"email" => user2.email,
"username" => 'test'
},
"user_id" => 19
}
]
end
it 'maps a member' do
expect(members_mapper.map[exported_user_id]).to eq(user2.id)
end
end
end end
context 'when importable is Project' do context 'when importable is Project' do
...@@ -212,7 +243,7 @@ RSpec.describe Gitlab::ImportExport::MembersMapper do ...@@ -212,7 +243,7 @@ RSpec.describe Gitlab::ImportExport::MembersMapper do
before do before do
group.add_users([user, user2], GroupMember::DEVELOPER) group.add_users([user, user2], GroupMember::DEVELOPER)
user.update(email: 'invite@test.com') user.update(public_email: 'invite@test.com')
end end
it 'maps the importer' do it 'maps the importer' do
......
...@@ -119,7 +119,7 @@ RSpec.describe Gitlab::ImportExport::Project::RelationFactory, :use_clean_rails_ ...@@ -119,7 +119,7 @@ RSpec.describe Gitlab::ImportExport::Project::RelationFactory, :use_clean_rails_
"updated_at" => "2016-11-18T09:29:42.634Z", "updated_at" => "2016-11-18T09:29:42.634Z",
"user" => { "user" => {
"id" => admin.id, "id" => admin.id,
"email" => admin.email, "public_email" => admin.email,
"username" => admin.username "username" => admin.username
} }
} }
...@@ -187,7 +187,7 @@ RSpec.describe Gitlab::ImportExport::Project::RelationFactory, :use_clean_rails_ ...@@ -187,7 +187,7 @@ RSpec.describe Gitlab::ImportExport::Project::RelationFactory, :use_clean_rails_
"updated_at" => "2016-11-18T09:29:42.634Z", "updated_at" => "2016-11-18T09:29:42.634Z",
"user" => { "user" => {
"id" => admin.id, "id" => admin.id,
"email" => admin.email, "public_email" => admin.email,
"username" => admin.username "username" => admin.username
} }
} }
......
...@@ -299,12 +299,13 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do ...@@ -299,12 +299,13 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
let(:member_emails) do let(:member_emails) do
emails = subject.map do |pm| emails = subject.map do |pm|
pm['user']['email'] pm['user']['public_email']
end end
emails emails
end end
before do before do
user2.update(public_email: user2.email)
group.add_developer(user2) group.add_developer(user2)
end end
......
...@@ -19,7 +19,7 @@ RSpec.shared_examples 'Notes user references' do ...@@ -19,7 +19,7 @@ RSpec.shared_examples 'Notes user references' do
'updated_at' => '2016-11-18T09:29:42.634Z', 'updated_at' => '2016-11-18T09:29:42.634Z',
'user' => { 'user' => {
'id' => 999, 'id' => 999,
'email' => mapped_user.email, 'public_email' => mapped_user.email,
'username' => mapped_user.username 'username' => mapped_user.username
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment