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
b36be538
Commit
b36be538
authored
Sep 05, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: Restore backward-compatibility for POST /projects/:id/members when membership is locked
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
9c059140
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
0 deletions
+33
-0
CHANGELOG-EE
CHANGELOG-EE
+6
-0
lib/api/members.rb
lib/api/members.rb
+6
-0
spec/requests/api/members_spec.rb
spec/requests/api/members_spec.rb
+21
-0
No files found.
CHANGELOG-EE
View file @
b36be538
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
v 8.12.0 (Unreleased)
v 8.12.0 (Unreleased)
v 8.11.5
- API: Restore backward-compatibility for POST /projects/:id/members when membership is locked
v 8.11.4
- No EE-specific changes
v 8.11.3
v 8.11.3
- [ES] Add logging to indexer
- [ES] Add logging to indexer
- Fix missing EE-specific service parameters for Jenkins CI
- Fix missing EE-specific service parameters for Jenkins CI
...
...
lib/api/members.rb
View file @
b36be538
...
@@ -59,6 +59,12 @@ module API
...
@@ -59,6 +59,12 @@ module API
authorize_admin_source!
(
source_type
,
source
)
authorize_admin_source!
(
source_type
,
source
)
required_attributes!
[
:user_id
,
:access_level
]
required_attributes!
[
:user_id
,
:access_level
]
## EE specific
if
source_type
==
'project'
&&
source
.
group
&&
source
.
group
.
membership_lock
not_allowed!
end
## EE specific
access_requester
=
source
.
requesters
.
find_by
(
user_id:
params
[
:user_id
])
access_requester
=
source
.
requesters
.
find_by
(
user_id:
params
[
:user_id
])
if
access_requester
if
access_requester
# We pass current_user = access_requester so that the requester doesn't
# We pass current_user = access_requester so that the requester doesn't
...
...
spec/requests/api/members_spec.rb
View file @
b36be538
...
@@ -162,6 +162,23 @@ describe API::Members, api: true do
...
@@ -162,6 +162,23 @@ describe API::Members, api: true do
end
end
end
end
## EE specific
shared_examples
'POST /projects/:id/members with the project group membership locked'
do
context
'project in a group'
do
it
'returns a 405 method not allowed error when group membership lock is enabled'
do
group_with_membership_locked
=
create
(
:group
,
membership_lock:
true
)
project
=
create
(
:project
,
group:
group_with_membership_locked
)
project
.
group
.
add_owner
(
master
)
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
master
),
user_id:
developer
.
id
,
access_level:
Member
::
MASTER
expect
(
response
.
status
).
to
eq
405
end
end
end
## EE specific
shared_examples
'PUT /:sources/:id/members/:user_id'
do
|
source_type
|
shared_examples
'PUT /:sources/:id/members/:user_id'
do
|
source_type
|
context
"with :sources ==
#{
source_type
.
pluralize
}
"
do
context
"with :sources ==
#{
source_type
.
pluralize
}
"
do
it_behaves_like
'a 404 response when source is private'
do
it_behaves_like
'a 404 response when source is private'
do
...
@@ -292,6 +309,10 @@ describe API::Members, api: true do
...
@@ -292,6 +309,10 @@ describe API::Members, api: true do
let
(
:source
)
{
project
}
let
(
:source
)
{
project
}
end
end
## EE specific
it_behaves_like
'POST /projects/:id/members with the project group membership locked'
## EE specific
it_behaves_like
'POST /:sources/:id/members'
,
'group'
do
it_behaves_like
'POST /:sources/:id/members'
,
'group'
do
let
(
:source
)
{
group
}
let
(
:source
)
{
group
}
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