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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
b52f27a9
Commit
b52f27a9
authored
Nov 20, 2018
by
Sanad Liaquat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add user to subgroup instead of sandbox. Some cleanup.
parent
1f5db25c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
112 additions
and
73 deletions
+112
-73
qa/.byebug_history
qa/.byebug_history
+6
-0
qa/qa/resource/group.rb
qa/qa/resource/group.rb
+4
-0
qa/qa/resource/sandbox.rb
qa/qa/resource/sandbox.rb
+1
-1
qa/qa/specs/features/browser_ui/1_manage/ee_group/group_ldap_sync_spec.rb
...ures/browser_ui/1_manage/ee_group/group_ldap_sync_spec.rb
+101
-72
No files found.
qa/.byebug_history
0 → 100644
View file @
b52f27a9
exit
post Runtime::API::Request.new(api_client, "/groups/#{group_path}/members").url, { user_id: parse_body(response).first[:id], access_level: '50' }.
group_path
user
parse_body(response).first[:id]
response
qa/qa/resource/group.rb
View file @
b52f27a9
...
...
@@ -51,6 +51,10 @@ module QA
"/groups/
#{
CGI
.
escape
(
"
#{
sandbox
.
path
}
/
#{
path
}
"
)
}
"
end
def
api_members_path
"
#{
api_get_path
}
/members"
end
def
api_post_path
'/groups'
end
...
...
qa/qa/resource/sandbox.rb
View file @
b52f27a9
...
...
@@ -7,7 +7,7 @@ module QA
# creating it if it doesn't yet exist.
#
class
Sandbox
<
Base
attr_
accesso
r
:path
attr_
reade
r
:path
attribute
:id
...
...
qa/qa/specs/features/browser_ui/1_manage/ee_group/group_ldap_sync_spec.rb
View file @
b52f27a9
...
...
@@ -6,77 +6,109 @@ module QA
include
Support
::
Api
before
(
:all
)
do
users
=
[
{
name:
'ENG User 2'
,
username:
'enguser2'
,
email:
'enguser2@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=enguser2,ou=people,ou=global groups,dc=example,dc=org'
},
{
name:
'ENG User 3'
,
username:
'enguser3'
,
email:
'enguser3@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=enguser3,ou=people,ou=global groups,dc=example,dc=org'
},
{
name:
'HR User 2'
,
username:
'hruser2'
,
email:
'hruser2@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=hruser2,ou=people,ou=global groups,dc=example,dc=org'
},
{
name:
'HR User 3'
,
username:
'hruser3'
,
email:
'hruser3@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=hruser3,ou=people,ou=global groups,dc=example,dc=org'
}
]
create_users_via_api
(
users
)
create_admin_personal_access_token
end
it
'Has LDAP user synced using group cn method'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
context
'using group cn method'
do
let
(
:ldap_users
)
do
[
{
name:
'ENG User 1'
,
username:
'enguser1'
,
email:
'enguser1@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=enguser1,ou=people,ou=global groups,dc=example,dc=org'
},
{
name:
'ENG User 2'
,
username:
'enguser2'
,
email:
'enguser2@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=enguser2,ou=people,ou=global groups,dc=example,dc=org'
},
{
name:
'ENG User 3'
,
username:
'enguser3'
,
email:
'enguser3@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=enguser3,ou=people,ou=global groups,dc=example,dc=org'
}
]
end
let
(
:owner_user
)
{
'enguser1'
}
let
(
:sync_users
)
{
[
'ENG User 2'
,
'ENG User 3'
]
}
sigin_in_and_create_group_with_user_via_api
(
user:
'enguser1'
,
group_name:
'Synched-engineering-group'
)
before
do
create_users_via_api
(
ldap_users
)
group
=
create_group_and_add_user_via_api
(
owner_user
,
'Synched-engineering-group'
)
signin_and_visit_group_as_user
(
owner_user
,
group
)
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_ldap_sync_settings
)
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_ldap_sync_settings
)
EE
::
Page
::
Group
::
Settings
::
LDAPSync
.
perform
do
|
page
|
page
.
set_sync_method
(
'LDAP Group cn'
)
page
.
set_group_cn
(
'Engineering'
)
page
.
click_add_sync_button
end
EE
::
Page
::
Group
::
Settings
::
LDAPSync
.
perform
do
|
page
|
page
.
set_sync_method
(
'LDAP Group cn'
)
page
.
set_group_cn
(
'Engineering'
)
page
.
click_add_sync_button
end
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_members
)
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_members
)
end
verify_users_synced
([
'ENG User 2'
,
'ENG User 3'
])
it
'has LDAP users synced'
do
verify_users_synced
(
sync_users
)
end
end
it
'Has LDAP user synced using user filter method'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
context
'user filter method'
do
let
(
:ldap_users
)
do
[
{
name:
'HR User 1'
,
username:
'hruser1'
,
email:
'hruser1@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=hruser1,ou=people,ou=global groups,dc=example,dc=org'
},
{
name:
'HR User 2'
,
username:
'hruser2'
,
email:
'hruser2@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=hruser2,ou=people,ou=global groups,dc=example,dc=org'
},
{
name:
'HR User 3'
,
username:
'hruser3'
,
email:
'hruser3@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=hruser3,ou=people,ou=global groups,dc=example,dc=org'
}
]
end
let
(
:owner_user
)
{
'hruser1'
}
let
(
:sync_users
)
{
[
'HR User 2'
,
'HR User 3'
]
}
sigin_in_and_create_group_with_user_via_api
(
user:
'hruser1'
,
group_name:
'Synched-human-resources-group'
)
before
do
create_users_via_api
(
ldap_users
)
group
=
create_group_and_add_user_via_api
(
owner_user
,
'Synched-human-resources-group'
)
signin_and_visit_group_as_user
(
owner_user
,
group
)
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_ldap_sync_settings
)
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_ldap_sync_settings
)
EE
::
Page
::
Group
::
Settings
::
LDAPSync
.
perform
do
|
page
|
page
.
set_user_filter
(
'(&(objectClass=person)(cn=HR*))'
)
page
.
click_add_sync_button
end
EE
::
Page
::
Group
::
Settings
::
LDAPSync
.
perform
do
|
page
|
page
.
set_user_filter
(
'(&(objectClass=person)(cn=HR*))'
)
page
.
click_add_sync_button
end
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_members
)
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_members
)
end
verify_users_synced
([
'HR User 2'
,
'HR User 3'
])
it
'has LDAP users synced'
do
verify_users_synced
(
sync_users
)
end
end
def
create_users_via_api
(
users
)
create_admin_personal_access_token
users
.
each
do
|
user
|
Resource
::
User
.
fabricate_via_api!
do
|
resource
|
resource
.
username
=
user
[
:username
]
...
...
@@ -88,12 +120,10 @@ module QA
end
end
def
add_user_to_sandbox_group_via_api
(
user
)
sandbox_group_path
=
Resource
::
Sandbox
.
fabricate_via_api!
.
path
api_client
=
Runtime
::
API
::
Client
.
new
(
:gitlab
,
personal_access_token:
Runtime
::
Env
.
personal_access_token
)
def
add_user_to_group_via_api
(
user
,
group
)
api_client
=
Runtime
::
API
::
Client
.
new
(
:gitlab
)
response
=
get
Runtime
::
API
::
Request
.
new
(
api_client
,
"/users?username=
#{
user
}
"
).
url
post
Runtime
::
API
::
Request
.
new
(
api_client
,
"/groups/
#{
sandbox_group_path
}
/members"
).
url
,
{
user_id:
parse_body
(
response
).
first
[
:id
],
access_level:
'50'
}
post
Runtime
::
API
::
Request
.
new
(
api_client
,
group
.
api_members_path
).
url
,
{
user_id:
parse_body
(
response
).
first
[
:id
],
access_level:
'50'
}
end
def
create_admin_personal_access_token
...
...
@@ -103,24 +133,23 @@ module QA
Page
::
Main
::
Menu
.
perform
(
&
:sign_out
)
end
def
sigin_in_and_create_group_with_user_via_api
(
user:
nil
,
group_name:
nil
)
Runtime
::
Env
.
ldap_username
=
user
Runtime
::
Env
.
ldap_password
=
'password'
Page
::
Main
::
Login
.
perform
do
|
login_page
|
login_page
.
sign_in_using_credentials
def
create_group_and_add_user_via_api
(
user_name
,
group_name
)
group
=
Resource
::
Group
.
fabricate_via_api!
do
|
resource
|
resource
.
path
=
"
#{
group_name
}
-
#{
SecureRandom
.
hex
(
4
)
}
"
end
Page
::
Main
::
Menu
.
perform
do
|
menu
|
expect
(
menu
).
to
have_personal_area
end
add_user_to_group_via_api
(
user_name
,
group
)
add_user_to_sandbox_group_via_api
(
user
)
group
end
Runtime
::
Env
.
personal_access_token
=
Resource
::
PersonalAccessToken
.
fabricate!
.
access_token
def
signin_and_visit_group_as_user
(
user_name
,
group
)
Runtime
::
Env
.
ldap_username
=
user_name
Runtime
::
Env
.
ldap_password
=
'password'
group
=
Resource
::
Group
.
fabricate_via_api!
do
|
resource
|
resource
.
path
=
"
#{
group_name
}
-
#{
SecureRandom
.
hex
(
4
)
}
"
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
perform
do
|
login_page
|
login_page
.
sign_in_using_credentials
end
group
.
visit!
...
...
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