Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
35442766
Commit
35442766
authored
Jan 18, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not map usersat all unless admin
parent
e2f0b830
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
lib/gitlab/import_export/members_mapper.rb
lib/gitlab/import_export/members_mapper.rb
+2
-2
spec/lib/gitlab/import_export/members_mapper_spec.rb
spec/lib/gitlab/import_export/members_mapper_spec.rb
+12
-1
No files found.
lib/gitlab/import_export/members_mapper.rb
View file @
35442766
...
@@ -4,7 +4,7 @@ module Gitlab
...
@@ -4,7 +4,7 @@ module Gitlab
attr_reader
:missing_author_ids
attr_reader
:missing_author_ids
def
initialize
(
exported_members
:,
user
:,
project
:)
def
initialize
(
exported_members
:,
user
:,
project
:)
@exported_members
=
exported_members
@exported_members
=
user
.
admin?
?
exported_members
:
[]
@user
=
user
@user
=
user
@project
=
project
@project
=
project
@missing_author_ids
=
[]
@missing_author_ids
=
[]
...
@@ -64,7 +64,7 @@ module Gitlab
...
@@ -64,7 +64,7 @@ module Gitlab
end
end
def
find_project_user_query
(
member
)
def
find_project_user_query
(
member
)
user_arel
[
:
username
].
eq
(
member
[
'user'
][
'username'
]).
or
(
user_arel
[
:email
].
eq
(
member
[
'user'
][
'email
'
]))
user_arel
[
:
email
].
eq
(
member
[
'user'
][
'email'
]).
or
(
user_arel
[
:username
].
eq
(
member
[
'user'
][
'username
'
]))
end
end
def
user_arel
def
user_arel
...
...
spec/lib/gitlab/import_export/members_mapper_spec.rb
View file @
35442766
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Gitlab
::
ImportExport
::
MembersMapper
,
services:
true
do
describe
Gitlab
::
ImportExport
::
MembersMapper
,
services:
true
do
describe
'map members'
do
describe
'map members'
do
let
(
:user
)
{
create
(
:
user
,
authorized_projects_populated:
true
)
}
let
(
:user
)
{
create
(
:
admin
,
authorized_projects_populated:
true
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
name:
'searchable_project'
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
name:
'searchable_project'
)
}
let
(
:user2
)
{
create
(
:user
,
authorized_projects_populated:
true
)
}
let
(
:user2
)
{
create
(
:user
,
authorized_projects_populated:
true
)
}
let
(
:exported_user_id
)
{
99
}
let
(
:exported_user_id
)
{
99
}
...
@@ -74,5 +74,16 @@ describe Gitlab::ImportExport::MembersMapper, services: true do
...
@@ -74,5 +74,16 @@ describe Gitlab::ImportExport::MembersMapper, services: true do
expect
(
user
.
authorized_project?
(
project
)).
to
be
true
expect
(
user
.
authorized_project?
(
project
)).
to
be
true
expect
(
user2
.
authorized_project?
(
project
)).
to
be
true
expect
(
user2
.
authorized_project?
(
project
)).
to
be
true
end
end
context
'user is not admin'
do
let
(
:user
)
{
create
(
:user
,
authorized_projects_populated:
true
)
}
it
'does not map a project member'
do
expect
(
members_mapper
.
map
[
exported_user_id
]).
to
eq
(
user
.
id
)
end
it
'defaults to importer project member if it does not exist'
do
expect
(
members_mapper
.
map
[
-
1
]).
to
eq
(
user
.
id
)
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment