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
7483ed5b
Commit
7483ed5b
authored
Nov 06, 2018
by
Sanad Liaquat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added another test and some refactoring
parent
810024a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
32 deletions
+60
-32
ee/app/views/ldap_group_links/_form.html.haml
ee/app/views/ldap_group_links/_form.html.haml
+1
-1
qa/qa/ee/page/group/settings/ldap_sync.rb
qa/qa/ee/page/group/settings/ldap_sync.rb
+5
-0
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
+54
-31
No files found.
ee/app/views/ldap_group_links/_form.html.haml
View file @
7483ed5b
...
...
@@ -36,7 +36,7 @@
=
f
.
label
:filter
,
class:
'col-form-label col-sm-2'
do
LDAP User filter
.col-sm-10
=
f
.
text_field
:filter
,
placeholder:
'Ex. (&(objectCategory=person)(objectClass=developer))'
,
class:
'form-control xxlarge input-mn-300'
=
f
.
text_field
:filter
,
placeholder:
'Ex. (&(objectCategory=person)(objectClass=developer))'
,
class:
'form-control xxlarge input-mn-300
qa-ldap-user-filter-text-field
'
.form-text.text-muted
-
ldap_link
=
link_to
'LDAP Search Filter Syntax'
,
'https://msdn.microsoft.com/en-us/library/aa746475(v=vs.85).aspx'
This query must use valid
#{
ldap_link
}
. Synchronize
#{
group
.
name
}
's members with this LDAP user filter.
...
...
qa/qa/ee/page/group/settings/ldap_sync.rb
View file @
7483ed5b
...
...
@@ -11,6 +11,7 @@ module QA
view
'ee/app/views/ldap_group_links/_form.html.haml'
do
element
:ldap_group_cn_select
element
:add_sync_button
element
:ldap_user_filter_text_field
end
def
set_sync_method
(
method
)
...
...
@@ -22,6 +23,10 @@ module QA
search_and_select
(
group_cn
)
end
def
set_user_filter
(
user_filter
)
fill_element
:ldap_user_filter_text_field
,
user_filter
end
def
click_add_sync_button
click_element
:add_sync_button
end
...
...
qa/qa/specs/features/browser_ui/1_manage/ee_group/group_ldap_sync_spec.rb
View file @
7483ed5b
# frozen_string_literal: true
module
QA
context
'Manage'
,
:orchestrated
,
:ldap_tls
do
# context 'Manage', :orchestrated, :ldap_tls do
context
'Manage'
do
describe
'LDAP Group Sync'
do
it
'Has LDAP user synced
with group
'
do
it
'Has LDAP user synced
using group cn method
'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
# Login and Logout enguser3
Page
::
Main
::
Login
.
perform
do
|
login_page
|
login_page
.
sign_in_using_ldap_credentials
(
username:
'enguser3'
,
password:
'password'
)
end
# Login users to create them
login_logout_users
([
'enguser3'
,
'enguser2'
])
Page
::
Main
::
Menu
.
perform
do
|
menu
|
expect
(
menu
).
to
have_personal_area
end
create_sandbox_group_with_user
(
user:
'enguser1'
,
group_name
:'Synched-engineering-group'
)
Page
::
Main
::
Menu
.
perform
(
&
:sign_out
)
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_ldap_sync_settings
)
# Login and Logout enguser2
Page
::
Main
::
Login
.
perform
do
|
login_page
|
login_page
.
sign_in_using_ldap_credentials
(
username:
'enguser2'
,
password:
'password'
)
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
Page
::
Main
::
Menu
.
perform
do
|
menu
|
expect
(
menu
).
to
have_personal_area
end
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_members
)
Page
::
Main
::
Menu
.
perform
(
&
:sign_out
)
verify_users_synched
([
'ENG User 2'
,
'ENG User 3'
]
)
# Login enguser1
Page
::
Main
::
Login
.
perform
do
|
login_page
|
login_page
.
sign_in_using_ldap_credentials
(
username:
'enguser1'
,
password:
'password'
)
end
end
Page
::
Main
::
Menu
.
perform
do
|
menu
|
expect
(
menu
).
to
have_personal_area
end
it
'Has LDAP user synced using user filter method'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
#
Create a sand box group
Resource
::
Sandbox
.
fabricate_via_browser_ui!
do
|
resource
|
resource
.
path
=
"Synched-engineering-group-
#{
SecureRandom
.
hex
(
4
)
}
"
end
#
Login users to create them
login_logout_users
([
'hruser3'
,
'hruser2'
])
create_sandbox_group_with_user
(
user:
'hruser1'
,
group_name
:'Synched-human-resources-group'
)
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
.
set_user_filter
(
'(&(objectClass=person)(cn=HR*))'
)
page
.
click_add_sync_button
end
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_members
)
verify_users_synched
([
'HR User 2'
,
'HR User 3'
])
end
def
login_logout_users
(
users
)
users
.
each
do
|
user
|
Page
::
Main
::
Login
.
perform
do
|
login_page
|
login_page
.
sign_in_using_ldap_credentials
(
username:
user
,
password:
'password'
)
end
Page
::
Main
::
Menu
.
perform
do
|
menu
|
expect
(
menu
).
to
have_personal_area
end
Page
::
Main
::
Menu
.
perform
(
&
:sign_out
)
end
end
def
create_sandbox_group_with_user
(
user:
nil
,
group_name:
nil
)
Page
::
Main
::
Login
.
perform
do
|
login_page
|
login_page
.
sign_in_using_ldap_credentials
(
username:
user
,
password:
'password'
)
end
Page
::
Main
::
Menu
.
perform
do
|
menu
|
expect
(
menu
).
to
have_personal_area
end
Resource
::
Sandbox
.
fabricate_via_browser_ui!
do
|
resource
|
resource
.
path
=
"
#{
group_name
}
-
#{
SecureRandom
.
hex
(
4
)
}
"
end
end
def
verify_users_synched
(
expected_users
)
users_synchronised
=
false
EE
::
Page
::
Group
::
Members
.
perform
do
|
page
|
page
.
click_sync_now
users_synchronised
=
page
.
with_retry
(
reload:
true
)
do
page
.
has_content?
(
'ENG User 2'
)
&&
page
.
has_content?
(
'ENG User 3'
)
expected_users
.
map
{
|
user
|
page
.
has_content?
(
user
)
}.
reduce
(
true
)
{
|
a
,
b
|
a
&&
b
}
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