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
acb8e33d
Commit
acb8e33d
authored
Nov 17, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix broken group creation API when passing LDAP parameters
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
2afa8654
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
lib/api/groups.rb
lib/api/groups.rb
+17
-6
No files found.
lib/api/groups.rb
View file @
acb8e33d
...
@@ -11,6 +11,12 @@ module API
...
@@ -11,6 +11,12 @@ module API
optional
:membership_lock
,
type:
Boolean
,
desc:
'Prevent adding new members to project membership within this group'
optional
:membership_lock
,
type:
Boolean
,
desc:
'Prevent adding new members to project membership within this group'
optional
:share_with_group_lock
,
type:
Boolean
,
desc:
'Prevent sharing a project with another group within this group'
optional
:share_with_group_lock
,
type:
Boolean
,
desc:
'Prevent sharing a project with another group within this group'
end
end
params
:optional_params_ee
do
optional
:ldap_cn
,
type:
String
,
desc:
'LDAP Common Name'
optional
:ldap_access
,
type:
Integer
,
desc:
'A valid access level'
all_or_none_of
:ldap_cn
,
:ldap_access
end
end
end
resource
:groups
do
resource
:groups
do
...
@@ -51,20 +57,25 @@ module API
...
@@ -51,20 +57,25 @@ module API
requires
:name
,
type:
String
,
desc:
'The name of the group'
requires
:name
,
type:
String
,
desc:
'The name of the group'
requires
:path
,
type:
String
,
desc:
'The path of the group'
requires
:path
,
type:
String
,
desc:
'The path of the group'
use
:optional_params
use
:optional_params
use
:optional_params_ee
end
end
post
do
post
do
authorize!
:create_group
authorize!
:create_group
ldap_link_attrs
=
{
cn:
params
.
delete
(
:ldap_cn
),
group_access:
params
.
delete
(
:ldap_access
)
}
group
=
::
Groups
::
CreateService
.
new
(
current_user
,
declared_params
(
include_missing:
false
)).
execute
group
=
::
Groups
::
CreateService
.
new
(
current_user
,
declared_params
(
include_missing:
false
)).
execute
if
group
.
persisted?
if
group
.
persisted?
# NOTE: add backwards compatibility for single ldap link
# NOTE: add backwards compatibility for single ldap link
ldap_attrs
=
attributes_for_keys
[
:ldap_cn
,
:ldap_access
]
if
ldap_link_attrs
[
:ldap_cn
].
present?
if
ldap_attrs
.
present?
group
.
ldap_group_links
.
create
(
@group
.
ldap_group_links
.
create
({
cn:
ldap_cn
,
cn:
ldap_attrs
[
:ldap_cn
],
group_access:
ldap_access
group_access:
ldap_attrs
[
:ldap_access
]
)
})
end
end
present
group
,
with:
Entities
::
Group
present
group
,
with:
Entities
::
Group
...
...
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