BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
47e4613f
Commit
47e4613f
authored
Jan 07, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code style fixes and some code simplified
parent
ec67e9be
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
11 deletions
+15
-11
identities_controller.rb
app/controllers/admin/identities_controller.rb
+2
-2
repair_ldap_blocked_user_service.rb
app/services/repair_ldap_blocked_user_service.rb
+9
-7
access.rb
lib/gitlab/ldap/access.rb
+3
-1
repair_ldap_blocked_user_service_spec.rb
spec/services/repair_ldap_blocked_user_service_spec.rb
+1
-1
No files found.
app/controllers/admin/identities_controller.rb
View file @
47e4613f
...
@@ -26,7 +26,7 @@ class Admin::IdentitiesController < Admin::ApplicationController
...
@@ -26,7 +26,7 @@ class Admin::IdentitiesController < Admin::ApplicationController
def
update
def
update
if
@identity
.
update_attributes
(
identity_params
)
if
@identity
.
update_attributes
(
identity_params
)
RepairLdapBlockedUserService
.
new
(
@user
,
@identity
).
execute
RepairLdapBlockedUserService
.
new
(
@user
).
execute
redirect_to
admin_user_identities_path
(
@user
),
notice:
'User identity was successfully updated.'
redirect_to
admin_user_identities_path
(
@user
),
notice:
'User identity was successfully updated.'
else
else
render
:edit
render
:edit
...
@@ -35,7 +35,7 @@ class Admin::IdentitiesController < Admin::ApplicationController
...
@@ -35,7 +35,7 @@ class Admin::IdentitiesController < Admin::ApplicationController
def
destroy
def
destroy
if
@identity
.
destroy
if
@identity
.
destroy
RepairLdapBlockedUserService
.
new
(
@user
,
@identity
).
execute
RepairLdapBlockedUserService
.
new
(
@user
).
execute
redirect_to
admin_user_identities_path
(
@user
),
notice:
'User identity was successfully removed.'
redirect_to
admin_user_identities_path
(
@user
),
notice:
'User identity was successfully removed.'
else
else
redirect_to
admin_user_identities_path
(
@user
),
alert:
'Failed to remove user identity.'
redirect_to
admin_user_identities_path
(
@user
),
alert:
'Failed to remove user identity.'
...
...
app/services/repair_ldap_blocked_user_service.rb
View file @
47e4613f
class
RepairLdapBlockedUserService
class
RepairLdapBlockedUserService
attr_accessor
:user
,
:identity
attr_accessor
:user
def
initialize
(
user
,
identity
)
def
initialize
(
user
)
@user
,
@identity
=
user
,
identity
@user
=
user
end
end
def
execute
def
execute
if
identity
.
destroyed?
user
.
block
if
ldap_hard_blocked?
user
.
block
if
identity
.
is_ldap?
&&
user
.
ldap_blocked?
&&
!
user
.
ldap_user?
else
user
.
block
if
!
identity
.
is_ldap?
&&
user
.
ldap_blocked?
&&
!
user
.
ldap_user?
end
end
private
def
ldap_hard_blocked?
user
.
ldap_blocked?
&&
!
user
.
ldap_user?
end
end
end
end
lib/gitlab/ldap/access.rb
View file @
47e4613f
...
@@ -40,7 +40,9 @@ module Gitlab
...
@@ -40,7 +40,9 @@ module Gitlab
user
.
ldap_block
user
.
ldap_block
false
false
else
else
user
.
activate
if
(
user
.
blocked?
&&
!
ldap_config
.
block_auto_created_users
)
||
user
.
ldap_blocked?
if
(
user
.
blocked?
&&
!
ldap_config
.
block_auto_created_users
)
||
user
.
ldap_blocked?
user
.
activate
end
true
true
end
end
else
else
...
...
spec/services/repair_ldap_blocked_user_service_spec.rb
View file @
47e4613f
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
RepairLdapBlockedUserService
,
services:
true
do
describe
RepairLdapBlockedUserService
,
services:
true
do
let
(
:user
)
{
create
(
:omniauth_user
,
provider:
'ldapmain'
,
state:
'ldap_blocked'
)
}
let
(
:user
)
{
create
(
:omniauth_user
,
provider:
'ldapmain'
,
state:
'ldap_blocked'
)
}
let
(
:identity
)
{
user
.
ldap_identity
}
let
(
:identity
)
{
user
.
ldap_identity
}
subject
(
:service
)
{
RepairLdapBlockedUserService
.
new
(
user
,
identity
)
}
subject
(
:service
)
{
RepairLdapBlockedUserService
.
new
(
user
)
}
describe
'#execute'
do
describe
'#execute'
do
it
'change to normal block after destroying last ldap identity'
do
it
'change to normal block after destroying last ldap identity'
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