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
9786eda8
Commit
9786eda8
authored
Oct 10, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split up ldap_extras feature into ldap_group_sync and multiple_ldap_servers
parent
07630469
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
19 additions
and
30 deletions
+19
-30
app/controllers/groups/ldaps_controller.rb
app/controllers/groups/ldaps_controller.rb
+1
-1
app/models/license.rb
app/models/license.rb
+4
-2
app/workers/ldap_all_groups_sync_worker.rb
app/workers/ldap_all_groups_sync_worker.rb
+1
-1
app/workers/ldap_group_sync_worker.rb
app/workers/ldap_group_sync_worker.rb
+1
-1
app/workers/ldap_sync_worker.rb
app/workers/ldap_sync_worker.rb
+1
-1
ee/app/views/groups/ee/_settings_nav.html.haml
ee/app/views/groups/ee/_settings_nav.html.haml
+1
-1
ee/lib/ee/gitlab/ldap/config.rb
ee/lib/ee/gitlab/ldap/config.rb
+0
-15
lib/api/groups.rb
lib/api/groups.rb
+1
-1
lib/gitlab/ldap/config.rb
lib/gitlab/ldap/config.rb
+1
-3
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+8
-4
No files found.
app/controllers/groups/ldaps_controller.rb
View file @
9786eda8
...
@@ -17,6 +17,6 @@ class Groups::LdapsController < Groups::ApplicationController
...
@@ -17,6 +17,6 @@ class Groups::LdapsController < Groups::ApplicationController
private
private
def
check_enabled_extras!
def
check_enabled_extras!
render_404
unless
Gitlab
::
LDAP
::
Config
.
enabled
_extras?
render_404
unless
Gitlab
::
LDAP
::
Config
.
enabled
?
&&
::
License
.
feature_available?
(
:ldap_group_sync
)
end
end
end
end
app/models/license.rb
View file @
9786eda8
...
@@ -18,7 +18,8 @@ class License < ActiveRecord::Base
...
@@ -18,7 +18,8 @@ class License < ActiveRecord::Base
issue_board_milestone
issue_board_milestone
issue_weights
issue_weights
jenkins_integration
jenkins_integration
ldap_extras
ldap_group_sync
multiple_ldap_servers
merge_request_approvers
merge_request_approvers
merge_request_rebase
merge_request_rebase
merge_request_squash
merge_request_squash
...
@@ -108,7 +109,8 @@ class License < ActiveRecord::Base
...
@@ -108,7 +109,8 @@ class License < ActiveRecord::Base
elastic_search
elastic_search
extended_audit_events
extended_audit_events
geo
geo
ldap_extras
ldap_group_sync
multiple_ldap_servers
object_storage
object_storage
repository_size_limit
repository_size_limit
]
.
freeze
]
.
freeze
...
...
app/workers/ldap_all_groups_sync_worker.rb
View file @
9786eda8
...
@@ -3,7 +3,7 @@ class LdapAllGroupsSyncWorker
...
@@ -3,7 +3,7 @@ class LdapAllGroupsSyncWorker
include
CronjobQueue
include
CronjobQueue
def
perform
def
perform
return
unless
Gitlab
::
LDAP
::
Config
.
enabled
_extras?
return
unless
Gitlab
::
LDAP
::
Config
.
enabled
?
&&
::
License
.
feature_available?
(
:ldap_group_sync
)
logger
.
info
'Started LDAP group sync'
logger
.
info
'Started LDAP group sync'
EE
::
Gitlab
::
LDAP
::
Sync
::
Groups
.
execute
EE
::
Gitlab
::
LDAP
::
Sync
::
Groups
.
execute
...
...
app/workers/ldap_group_sync_worker.rb
View file @
9786eda8
...
@@ -3,7 +3,7 @@ class LdapGroupSyncWorker
...
@@ -3,7 +3,7 @@ class LdapGroupSyncWorker
include
DedicatedSidekiqQueue
include
DedicatedSidekiqQueue
def
perform
(
group_ids
,
provider
=
nil
)
def
perform
(
group_ids
,
provider
=
nil
)
return
unless
Gitlab
::
LDAP
::
Config
.
enabled
_extras?
return
unless
Gitlab
::
LDAP
::
Config
.
enabled
?
&&
::
License
.
feature_available?
(
:ldap_group_sync
)
groups
=
Group
.
where
(
id:
Array
(
group_ids
))
groups
=
Group
.
where
(
id:
Array
(
group_ids
))
...
...
app/workers/ldap_sync_worker.rb
View file @
9786eda8
...
@@ -3,7 +3,7 @@ class LdapSyncWorker
...
@@ -3,7 +3,7 @@ class LdapSyncWorker
include
CronjobQueue
include
CronjobQueue
def
perform
def
perform
return
unless
Gitlab
::
LDAP
::
Config
.
enabled
_extras?
return
unless
Gitlab
::
LDAP
::
Config
.
enabled
?
&&
::
License
.
feature_available?
(
:ldap_group_sync
)
Rails
.
logger
.
info
"Performing daily LDAP sync task."
Rails
.
logger
.
info
"Performing daily LDAP sync task."
User
.
ldap
.
find_each
(
batch_size:
100
).
each
do
|
ldap_user
|
User
.
ldap
.
find_each
(
batch_size:
100
).
each
do
|
ldap_user
|
...
...
ee/app/views/groups/ee/_settings_nav.html.haml
View file @
9786eda8
-
if
Gitlab
::
LDAP
::
Config
.
enabled
_extras?
&&
can?
(
current_user
,
:admin_ldap_group_links
,
@group
)
-
if
Gitlab
::
LDAP
::
Config
.
enabled
?
&&
::
License
.
feature_available?
(
:ldap_group_sync
)
&&
can?
(
current_user
,
:admin_ldap_group_links
,
@group
)
=
nav_link
(
path:
'ldap_group_links#index'
)
do
=
nav_link
(
path:
'ldap_group_links#index'
)
do
=
link_to
group_ldap_group_links_path
(
@group
),
title:
'LDAP Group'
do
=
link_to
group_ldap_group_links_path
(
@group
),
title:
'LDAP Group'
do
%span
%span
...
...
ee/lib/ee/gitlab/ldap/config.rb
deleted
100644 → 0
View file @
07630469
module
EE
module
Gitlab
module
LDAP
module
Config
extend
ActiveSupport
::
Concern
class_methods
do
def
enabled_extras?
enabled?
&&
::
License
.
feature_available?
(
:ldap_extras
)
end
end
end
end
end
end
lib/api/groups.rb
View file @
9786eda8
...
@@ -213,7 +213,7 @@ module API
...
@@ -213,7 +213,7 @@ module API
desc
'Sync a group with LDAP.'
desc
'Sync a group with LDAP.'
post
":id/ldap_sync"
do
post
":id/ldap_sync"
do
not_found!
unless
Gitlab
::
LDAP
::
Config
.
enabled
_extras?
not_found!
unless
Gitlab
::
LDAP
::
Config
.
enabled
?
&&
::
License
.
feature_available?
(
:ldap_group_sync
)
group
=
find_group!
(
params
[
:id
])
group
=
find_group!
(
params
[
:id
])
authorize!
:admin_group
,
group
authorize!
:admin_group
,
group
...
...
lib/gitlab/ldap/config.rb
View file @
9786eda8
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
module
Gitlab
module
Gitlab
module
LDAP
module
LDAP
class
Config
class
Config
include
::
EE
::
Gitlab
::
LDAP
::
Config
NET_LDAP_ENCRYPTION_METHOD
=
{
NET_LDAP_ENCRYPTION_METHOD
=
{
simple_tls: :simple_tls
,
simple_tls: :simple_tls
,
start_tls: :start_tls
,
start_tls: :start_tls
,
...
@@ -27,7 +25,7 @@ module Gitlab
...
@@ -27,7 +25,7 @@ module Gitlab
def
self
.
available_servers
def
self
.
available_servers
return
[]
unless
enabled?
return
[]
unless
enabled?
enabled_extras?
?
servers
:
Array
.
wrap
(
servers
.
first
)
::
License
.
feature_available?
(
:multiple_ldap_servers
)
?
servers
:
Array
.
wrap
(
servers
.
first
)
end
end
def
self
.
providers
def
self
.
providers
...
...
spec/requests/api/groups_spec.rb
View file @
9786eda8
...
@@ -700,9 +700,13 @@ describe API::Groups do
...
@@ -700,9 +700,13 @@ describe API::Groups do
end
end
describe
'POST /groups/:id/ldap_sync'
do
describe
'POST /groups/:id/ldap_sync'
do
context
'when LDAP config enabled_extras is true'
do
before
do
allow
(
Gitlab
::
LDAP
::
Config
).
to
receive
(
:enabled?
).
and_return
(
true
)
end
context
'when the ldap_group_sync feature is available'
do
before
do
before
do
allow
(
Gitlab
::
LDAP
::
Config
).
to
receive
(
:enabled_extras?
).
and_return
(
true
)
stub_licensed_features
(
ldap_group_sync:
true
)
end
end
context
'when authenticated as the group owner'
do
context
'when authenticated as the group owner'
do
...
@@ -772,9 +776,9 @@ describe API::Groups do
...
@@ -772,9 +776,9 @@ describe API::Groups do
end
end
end
end
context
'when
LDAP config enabled_extras is fals
e'
do
context
'when
the ldap_group_sync feature is not availabl
e'
do
before
do
before
do
allow
(
Gitlab
::
LDAP
::
Config
).
to
receive
(
:enabled_extras?
).
and_return
(
false
)
stub_licensed_features
(
ldap_group_sync:
false
)
end
end
it
'returns 404 (same as CE would)'
do
it
'returns 404 (same as CE would)'
do
...
...
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