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
7b6dd7b3
Commit
7b6dd7b3
authored
Jan 11, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve conflicts
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
baf94bf1
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
351 deletions
+61
-351
.rubocop_todo.yml
.rubocop_todo.yml
+1
-274
Gemfile.lock
Gemfile.lock
+0
-12
lib/gitlab/ldap/access.rb
lib/gitlab/ldap/access.rb
+18
-19
spec/lib/gitlab/ldap/access_spec.rb
spec/lib/gitlab/ldap/access_spec.rb
+42
-46
No files found.
.rubocop_todo.yml
View file @
7b6dd7b3
This diff is collapsed.
Click to expand it.
Gemfile.lock
View file @
7b6dd7b3
...
...
@@ -284,14 +284,10 @@ GEM
diff-lcs (~> 1.1)
mime-types (>= 1.16, < 3)
posix-spawn (~> 0.3)
<<<<<<< HEAD
gitlab-license (1.0.0)
gitlab-markup (1.5.0)
=======
gitlab-markup (1.5.1)
gitlab-turbolinks-classic (2.5.6)
coffee-rails
>>>>>>> ce/master
gitlab_omniauth-ldap (1.2.1)
net-ldap (~> 0.9)
omniauth (~> 1.0)
...
...
@@ -923,13 +919,9 @@ DEPENDENCIES
github-linguist (~> 4.7.0)
gitlab-elasticsearch-git (~> 1.0.1)
gitlab-flowdock-git-hook (~> 1.0.1)
<<<<<<< HEAD
gitlab-license (~> 1.0)
gitlab-markup (~> 1.5.0)
=======
gitlab-markup (~> 1.5.1)
gitlab-turbolinks-classic (~> 2.5, >= 2.5.6)
>>>>>>> ce/master
gitlab_omniauth-ldap (~> 1.2.1)
gollum-lib (~> 4.2)
gollum-rugged_adapter (~> 0.4.2)
...
...
@@ -1012,11 +1004,7 @@ DEPENDENCIES
rqrcode-rails3 (~> 0.1.7)
rspec-rails (~> 3.5.0)
rspec-retry (~> 0.4.5)
<<<<<<< HEAD
rubocop (~> 0.43.0)
=======
rubocop (~> 0.46.0)
>>>>>>> ce/master
rubocop-rspec (~> 1.9.1)
ruby-fogbugz (~> 0.2.1)
ruby-prof (~> 0.16.2)
...
...
lib/gitlab/ldap/access.rb
View file @
7b6dd7b3
...
...
@@ -69,7 +69,24 @@ module Gitlab
@ldap_user
||=
Gitlab
::
LDAP
::
Person
.
find_by_dn
(
user
.
ldap_identity
.
extern_uid
,
adapter
)
end
<<<<<<<
HEAD
def
block_user
(
user
,
reason
)
user
.
ldap_block
Gitlab
::
AppLogger
.
info
(
"LDAP account
\"
#{
user
.
ldap_identity
.
extern_uid
}
\"
#{
reason
}
, "
\
"blocking Gitlab user
\"
#{
user
.
name
}
\"
(
#{
user
.
email
}
)"
)
end
def
unblock_user
(
user
,
reason
)
user
.
activate
Gitlab
::
AppLogger
.
info
(
"LDAP account
\"
#{
user
.
ldap_identity
.
extern_uid
}
\"
#{
reason
}
, "
\
"unblocking Gitlab user
\"
#{
user
.
name
}
\"
(
#{
user
.
email
}
)"
)
end
def
update_user
update_email
update_ssh_keys
if
sync_ssh_keys?
...
...
@@ -151,24 +168,6 @@ module Gitlab
def
logger
Rails
.
logger
=======
def
block_user
(
user
,
reason
)
user
.
ldap_block
Gitlab
::
AppLogger
.
info
(
"LDAP account
\"
#{
user
.
ldap_identity
.
extern_uid
}
\"
#{
reason
}
, "
\
"blocking Gitlab user
\"
#{
user
.
name
}
\"
(
#{
user
.
email
}
)"
)
end
def
unblock_user
(
user
,
reason
)
user
.
activate
Gitlab
::
AppLogger
.
info
(
"LDAP account
\"
#{
user
.
ldap_identity
.
extern_uid
}
\"
#{
reason
}
, "
\
"unblocking Gitlab user
\"
#{
user
.
name
}
\"
(
#{
user
.
email
}
)"
)
>>>>>>>
ce
/
master
end
end
end
...
...
spec/lib/gitlab/ldap/access_spec.rb
View file @
7b6dd7b3
...
...
@@ -14,13 +14,9 @@ describe Gitlab::LDAP::Access, lib: true do
it
{
is_expected
.
to
be_falsey
}
<<<<<<<
HEAD
it
'blocks user in GitLab'
do
=======
it
'should block user in GitLab'
do
expect
(
access
).
to
receive
(
:block_user
).
with
(
user
,
'does not exist anymore'
)
>>>>>>>
ce
/
master
access
.
allowed?
end
end
...
...
@@ -116,7 +112,48 @@ describe Gitlab::LDAP::Access, lib: true do
end
end
<<<<<<<
HEAD
describe
'#block_user'
do
before
do
user
.
activate
allow
(
Gitlab
::
AppLogger
).
to
receive
(
:info
)
access
.
block_user
user
,
'reason'
end
it
'blocks the user'
do
expect
(
user
).
to
be_blocked
expect
(
user
).
to
be_ldap_blocked
end
it
'logs the reason'
do
expect
(
Gitlab
::
AppLogger
).
to
have_received
(
:info
).
with
(
"LDAP account
\"
123456
\"
reason, "
\
"blocking Gitlab user
\"
#{
user
.
name
}
\"
(
#{
user
.
email
}
)"
)
end
end
describe
'#unblock_user'
do
before
do
user
.
ldap_block
allow
(
Gitlab
::
AppLogger
).
to
receive
(
:info
)
access
.
unblock_user
user
,
'reason'
end
it
'activates the user'
do
expect
(
user
).
not_to
be_blocked
expect
(
user
).
not_to
be_ldap_blocked
end
it
'logs the reason'
do
Gitlab
::
AppLogger
.
info
(
"LDAP account
\"
123456
\"
reason, "
\
"unblocking Gitlab user
\"
#{
user
.
name
}
\"
(
#{
user
.
email
}
)"
)
end
end
describe
'#update_user'
do
subject
{
access
.
update_user
}
let
(
:entry
)
do
...
...
@@ -266,47 +303,6 @@ describe Gitlab::LDAP::Access, lib: true do
it
"updates the email if the user email is different"
do
entry
[
'mail'
]
=
[
"new_email@example.com"
]
expect
{
access
.
update_email
}.
to
change
(
user
,
:email
)
=======
describe
'#block_user'
do
before
do
user
.
activate
allow
(
Gitlab
::
AppLogger
).
to
receive
(
:info
)
access
.
block_user
user
,
'reason'
end
it
'blocks the user'
do
expect
(
user
).
to
be_blocked
expect
(
user
).
to
be_ldap_blocked
end
it
'logs the reason'
do
expect
(
Gitlab
::
AppLogger
).
to
have_received
(
:info
).
with
(
"LDAP account
\"
123456
\"
reason, "
\
"blocking Gitlab user
\"
#{
user
.
name
}
\"
(
#{
user
.
email
}
)"
)
end
end
describe
'#unblock_user'
do
before
do
user
.
ldap_block
allow
(
Gitlab
::
AppLogger
).
to
receive
(
:info
)
access
.
unblock_user
user
,
'reason'
end
it
'activates the user'
do
expect
(
user
).
not_to
be_blocked
expect
(
user
).
not_to
be_ldap_blocked
end
it
'logs the reason'
do
Gitlab
::
AppLogger
.
info
(
"LDAP account
\"
123456
\"
reason, "
\
"unblocking Gitlab user
\"
#{
user
.
name
}
\"
(
#{
user
.
email
}
)"
)
>>>>>>>
ce
/
master
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