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
70417307
Commit
70417307
authored
Oct 05, 2018
by
Robert Speicher
Committed by
Douglas Barbosa Alexandre
Oct 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additional feature flag check for EE::Project
parent
ecb6c46c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+5
-2
ee/spec/models/project_spec.rb
ee/spec/models/project_spec.rb
+8
-0
No files found.
ee/app/models/ee/project.rb
View file @
70417307
...
@@ -266,7 +266,7 @@ module EE
...
@@ -266,7 +266,7 @@ module EE
if
ProjectFeature
::
FEATURES
.
include?
(
feature
)
if
ProjectFeature
::
FEATURES
.
include?
(
feature
)
super
super
else
else
licensed_feature_available?
(
feature
)
licensed_feature_available?
(
feature
,
user
)
end
end
end
end
...
@@ -578,7 +578,10 @@ module EE
...
@@ -578,7 +578,10 @@ module EE
import_state
.
set_next_execution_to_now
import_state
.
set_next_execution_to_now
end
end
def
licensed_feature_available?
(
feature
)
def
licensed_feature_available?
(
feature
,
user
=
nil
)
# This feature might not be behind a feature flag at all, so default to true
return
false
unless
::
Feature
.
enabled?
(
feature
,
user
,
default_enabled:
true
)
available_features
=
strong_memoize
(
:licensed_feature_available
)
do
available_features
=
strong_memoize
(
:licensed_feature_available
)
do
Hash
.
new
do
|
h
,
feature
|
Hash
.
new
do
|
h
,
feature
|
h
[
feature
]
=
load_licensed_feature_available
(
feature
)
h
[
feature
]
=
load_licensed_feature_available
(
feature
)
...
...
ee/spec/models/project_spec.rb
View file @
70417307
...
@@ -347,6 +347,14 @@ describe Project do
...
@@ -347,6 +347,14 @@ describe Project do
it
'returns true'
do
it
'returns true'
do
is_expected
.
to
eq
(
true
)
is_expected
.
to
eq
(
true
)
end
end
context
'when feature is disabled by a feature flag'
do
it
'returns false'
do
stub_feature_flags
(
feature
=>
false
)
is_expected
.
to
eq
(
false
)
end
end
end
end
context
'not allowed by Plan License but project and namespace are public'
do
context
'not allowed by Plan License but project and namespace are public'
do
...
...
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