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
3457b959
Commit
3457b959
authored
Sep 23, 2020
by
Jason Goodman
Committed by
Kamil Trzciński
Sep 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow Unleash clients to request feature flags for private repos
Continue to forbid clients for disabled repos
parent
e9506d0a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
7 deletions
+23
-7
changelogs/unreleased/unleash-api-with-private-repo.yml
changelogs/unreleased/unleash-api-with-private-repo.yml
+5
-0
ee/lib/api/unleash.rb
ee/lib/api/unleash.rb
+0
-5
ee/spec/requests/api/unleash_spec.rb
ee/spec/requests/api/unleash_spec.rb
+18
-2
No files found.
changelogs/unreleased/unleash-api-with-private-repo.yml
0 → 100644
View file @
3457b959
---
title
:
Allow Unleash clients to request feature flags when repository is private
merge_request
:
43059
author
:
type
:
fixed
ee/lib/api/unleash.rb
View file @
3457b959
...
...
@@ -14,7 +14,6 @@ module API
route_param
:project_id
do
before
do
authorize_by_unleash_instance_id!
authorize_feature_flags_feature!
end
get
do
...
...
@@ -65,10 +64,6 @@ module API
.
find_for_project_and_token
(
project
,
unleash_instance_id
)
end
def
authorize_feature_flags_feature!
forbidden!
unless
project
.
feature_available?
(
:repository
)
end
def
feature_flags
return
[]
unless
unleash_app_name
.
present?
...
...
ee/spec/requests/api/unleash_spec.rb
View file @
3457b959
...
...
@@ -21,7 +21,7 @@ RSpec.describe API::Unleash do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
context
'when
feature is not available
'
do
context
'when
repository is disabled
'
do
before
do
project
.
project_feature
.
update!
(
repository_access_level:
::
ProjectFeature
::
DISABLED
,
...
...
@@ -33,7 +33,23 @@ RSpec.describe API::Unleash do
it
'responds with forbidden'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
context
'when repository is private'
do
before
do
project
.
project_feature
.
update!
(
repository_access_level:
::
ProjectFeature
::
PRIVATE
,
merge_requests_access_level:
::
ProjectFeature
::
DISABLED
,
builds_access_level:
::
ProjectFeature
::
DISABLED
)
end
it
'responds with OK'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
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