Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
887a8a9b38fe
Commit
e7f4f0ae
authored
Mar 12, 2015
by
Dmitriy Zaporozhets
Browse files
Block user if he/she was blocked in Active Directory
parent
c556dca74e62
Changes
3
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
887a8a9b
...
...
@@ -59,6 +59,7 @@ v 7.9.0 (unreleased)
- Added blue thmeme
- Remove annoying notice messages when create/update merge request
- Allow smb:// links in Markdown text.
- Block user if he/she was blocked in Active Directory
v 7.8.4
- Fix issue_tracker_id substitution in custom issue trackers
...
...
lib/gitlab/ldap/access.rb
View file @
887a8a9b
...
...
@@ -34,7 +34,14 @@ def initialize(user, adapter=nil)
def
allowed?
if
Gitlab
::
LDAP
::
Person
.
find_by_dn
(
user
.
ldap_identity
.
extern_uid
,
adapter
)
return
true
unless
ldap_config
.
active_directory
!
Gitlab
::
LDAP
::
Person
.
disabled_via_active_directory?
(
user
.
ldap_identity
.
extern_uid
,
adapter
)
# 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
)
user
.
block
unless
user
.
blocked?
false
else
true
end
else
false
end
...
...
spec/lib/gitlab/ldap/access_spec.rb
View file @
887a8a9b
...
...
@@ -20,6 +20,11 @@
before
{
Gitlab
::
LDAP
::
Person
.
stub
(
disabled_via_active_directory?:
true
)
}
it
{
is_expected
.
to
be_falsey
}
it
"should block user in GitLab"
do
access
.
allowed?
user
.
should
be_blocked
end
end
context
'and has no disabled flag in active diretory'
do
...
...
@@ -38,4 +43,4 @@
end
end
end
end
\ No newline at end of file
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