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
c982a8f0
Commit
c982a8f0
authored
Aug 15, 2014
by
Jan-Willem van der Meer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add backwards compatibility for creating groups with a LDAP connection
parent
0929fbca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
lib/api/groups.rb
lib/api/groups.rb
+10
-3
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+7
-0
No files found.
lib/api/groups.rb
View file @
c982a8f0
...
...
@@ -44,12 +44,19 @@ module API
authenticated_as_admin!
required_attributes!
[
:name
,
:path
]
# TODO: Refactor to support multi-ldap
attrs
=
attributes_for_keys
[
:name
,
:path
,
:ldap_cn
,
:ldap_access
]
@group
=
Group
.
new
(
attrs
)
group_attrs
=
attributes_for_keys
[
:name
,
:path
]
@group
=
Group
.
new
(
group_attrs
)
@group
.
owner
=
current_user
if
@group
.
save
# NOTE: add backwards compatibility for single ldap link
ldap_attrs
=
attributes_for_keys
[
:ldap_cn
,
:ldap_access
]
if
ldap_attrs
.
present?
@group
.
ldap_group_links
.
create
({
cn:
ldap_attrs
[
:ldap_cn
],
group_access:
ldap_attrs
[
:ldap_access
]
})
end
present
@group
,
with:
Entities
::
Group
else
not_found!
...
...
spec/requests/api/groups_spec.rb
View file @
c982a8f0
...
...
@@ -110,6 +110,13 @@ describe API::API, api: true do
post
api
(
"/groups"
,
admin
),
{
name:
'test'
}
response
.
status
.
should
==
400
end
it
"creates an ldap_group_link if ldap_cn and ldap_access are supplied"
do
group_attributes
=
attributes_for
(
:group
,
ldap_cn:
'ldap-group'
,
ldap_access:
Gitlab
::
Access
::
DEVELOPER
)
expect
{
post
api
(
"/groups"
,
admin
),
group_attributes
}.
to
change
{
LdapGroupLink
.
count
}.
by
(
1
)
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