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
2f006f89
Commit
2f006f89
authored
Dec 08, 2014
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix specs after merge CE -> EE
parent
9ceccf7c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
9 deletions
+8
-9
app/models/members/group_member.rb
app/models/members/group_member.rb
+1
-2
lib/gitlab/ldap/access.rb
lib/gitlab/ldap/access.rb
+2
-2
spec/lib/gitlab/ldap/access_spec.rb
spec/lib/gitlab/ldap/access_spec.rb
+3
-3
spec/services/ldap_group_reset_service_spec.rb
spec/services/ldap_group_reset_service_spec.rb
+2
-2
No files found.
app/models/members/group_member.rb
View file @
2f006f89
...
...
@@ -26,8 +26,7 @@ class GroupMember < Member
scope
:with_group
,
->
(
group
)
{
where
(
source_id:
group
.
id
)
}
scope
:with_user
,
->
(
user
)
{
where
(
user_id:
user
.
id
)
}
scope
:with_ldap_dn
,
->
{
references
(
:user
).
includes
(
:user
).
where
(
users:
{
provider:
'ldap'
})
}
scope
:with_ldap_dn
,
->
{
joins
(
user: :identities
).
where
(
"identities.provider LIKE ?"
,
'ldap%'
)
}
after_create
:notify_create
after_update
:notify_update
...
...
lib/gitlab/ldap/access.rb
View file @
2f006f89
...
...
@@ -54,7 +54,7 @@ module Gitlab
end
def
ldap_user
@ldap_user
||=
Gitlab
::
LDAP
::
Person
.
find_by_dn
(
user
.
extern_uid
,
adapter
)
@ldap_user
||=
Gitlab
::
LDAP
::
Person
.
find_by_dn
(
user
.
ldap_identity
.
extern_uid
,
adapter
)
end
def
update_permissions
...
...
@@ -110,7 +110,7 @@ module Gitlab
def
update_admin_status
admin_group
=
Gitlab
::
LDAP
::
Group
.
find_by_cn
(
ldap_config
.
admin_group
,
adapter
)
if
admin_group
.
has_member?
(
Gitlab
::
LDAP
::
Person
.
find_by_dn
(
user
.
extern_uid
,
adapter
))
if
admin_group
.
has_member?
(
Gitlab
::
LDAP
::
Person
.
find_by_dn
(
user
.
ldap_identity
.
extern_uid
,
adapter
))
unless
user
.
admin?
user
.
admin
=
true
user
.
save
...
...
spec/lib/gitlab/ldap/access_spec.rb
View file @
2f006f89
...
...
@@ -129,7 +129,7 @@ describe Gitlab::LDAP::Access do
let
(
:entry
)
{
Net
::
LDAP
::
Entry
.
new
}
before
do
access
.
stub
ldap_user:
Gitlab
::
LDAP
::
Person
.
new
(
entry
,
user
.
provider
)
access
.
stub
ldap_user:
Gitlab
::
LDAP
::
Person
.
new
(
entry
,
user
.
ldap_identity
.
provider
)
end
it
"should not update email if email attribute is not set"
do
...
...
@@ -157,7 +157,7 @@ describe Gitlab::LDAP::Access do
before
do
access
.
stub
(
admin_group:
"GLAdmins"
)
ldap_user_entry
=
Net
::
LDAP
::
Entry
.
new
Gitlab
::
LDAP
::
Adapter
.
any_instance
.
stub
(
:user
)
{
Gitlab
::
LDAP
::
Person
.
new
(
ldap_user_entry
,
user
.
provider
)
}
Gitlab
::
LDAP
::
Adapter
.
any_instance
.
stub
(
:user
)
{
Gitlab
::
LDAP
::
Person
.
new
(
ldap_user_entry
,
user
.
ldap_identity
.
provider
)
}
Gitlab
::
LDAP
::
Person
.
any_instance
.
stub
(
:uid
)
{
'admin2'
}
end
...
...
@@ -319,7 +319,7 @@ objectclass: posixGroup
Gitlab
::
LDAP
::
Group
.
new
(
ldap_group_response_2
)
]
end
let
(
:ldap_user
)
{
Gitlab
::
LDAP
::
Person
.
new
(
Net
::
LDAP
::
Entry
.
new
,
user
.
provider
)
}
let
(
:ldap_user
)
{
Gitlab
::
LDAP
::
Person
.
new
(
Net
::
LDAP
::
Entry
.
new
,
user
.
ldap_identity
.
provider
)
}
before
do
access
.
stub
(
ldap_user:
ldap_user
)
...
...
spec/services/ldap_group_reset_service_spec.rb
View file @
2f006f89
...
...
@@ -4,8 +4,8 @@ describe LdapGroupResetService do
# TODO: refactor to multi-ldap setup
let
(
:group
)
{
create
(
:group
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:ldap_user
)
{
create
(
:user
,
extern_uid:
'john'
,
provider:
'ldap'
,
last_credential_check_at:
Time
.
now
)
}
let
(
:ldap_user_2
)
{
create
(
:user
,
extern_uid:
'mike'
,
provider:
'ldap'
,
last_credential_check_at:
Time
.
now
)
}
let
(
:ldap_user
)
{
create
(
:
omniauth_
user
,
extern_uid:
'john'
,
provider:
'ldap'
,
last_credential_check_at:
Time
.
now
)
}
let
(
:ldap_user_2
)
{
create
(
:
omniauth_
user
,
extern_uid:
'mike'
,
provider:
'ldap'
,
last_credential_check_at:
Time
.
now
)
}
before
do
group
.
add_owner
(
user
)
...
...
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