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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
5ee6bada
Commit
5ee6bada
authored
Apr 05, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unblocks user when active_directory is disabled and it can be found
parent
4a01b5e2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
lib/gitlab/ldap/access.rb
lib/gitlab/ldap/access.rb
+4
-1
spec/lib/gitlab/ldap/access_spec.rb
spec/lib/gitlab/ldap/access_spec.rb
+26
-1
No files found.
lib/gitlab/ldap/access.rb
View file @
5ee6bada
...
@@ -33,7 +33,10 @@ module Gitlab
...
@@ -33,7 +33,10 @@ module Gitlab
def
allowed?
def
allowed?
if
ldap_user
if
ldap_user
return
true
unless
ldap_config
.
active_directory
unless
ldap_config
.
active_directory
user
.
activate
if
user
.
ldap_blocked?
return
true
end
# Block user in GitLab if he/she was blocked in AD
# Block user in GitLab if he/she was blocked in AD
if
Gitlab
::
LDAP
::
Person
.
disabled_via_active_directory?
(
user
.
ldap_identity
.
extern_uid
,
adapter
)
if
Gitlab
::
LDAP
::
Person
.
disabled_via_active_directory?
(
user
.
ldap_identity
.
extern_uid
,
adapter
)
...
...
spec/lib/gitlab/ldap/access_spec.rb
View file @
5ee6bada
...
@@ -33,7 +33,7 @@ describe Gitlab::LDAP::Access, lib: true do
...
@@ -33,7 +33,7 @@ describe Gitlab::LDAP::Access, lib: true do
it
{
is_expected
.
to
be_falsey
}
it
{
is_expected
.
to
be_falsey
}
it
'
should block
user in GitLab'
do
it
'
blocks
user in GitLab'
do
access
.
allowed?
access
.
allowed?
expect
(
user
).
to
be_blocked
expect
(
user
).
to
be_blocked
expect
(
user
).
to
be_ldap_blocked
expect
(
user
).
to
be_ldap_blocked
...
@@ -78,6 +78,31 @@ describe Gitlab::LDAP::Access, lib: true do
...
@@ -78,6 +78,31 @@ describe Gitlab::LDAP::Access, lib: true do
end
end
it
{
is_expected
.
to
be_truthy
}
it
{
is_expected
.
to
be_truthy
}
context
'when user cannot be found'
do
before
do
allow
(
Gitlab
::
LDAP
::
Person
).
to
receive
(
:find_by_dn
).
and_return
(
nil
)
end
it
{
is_expected
.
to
be_falsey
}
it
'blocks user in GitLab'
do
access
.
allowed?
expect
(
user
).
to
be_blocked
expect
(
user
).
to
be_ldap_blocked
end
end
context
'when user was previously ldap_blocked'
do
before
do
user
.
ldap_block
end
it
'unblocks the user if it exists'
do
access
.
allowed?
expect
(
user
).
not_to
be_blocked
end
end
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