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
cc441566
Commit
cc441566
authored
May 26, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable availability of feature if not permmited on license
parent
61f6b87c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
1 deletion
+19
-1
app/models/license.rb
app/models/license.rb
+3
-1
app/policies/ee/project_policy.rb
app/policies/ee/project_policy.rb
+5
-0
spec/controllers/projects/issue_links_controller_spec.rb
spec/controllers/projects/issue_links_controller_spec.rb
+5
-0
spec/services/issue_links/create_service_spec.rb
spec/services/issue_links/create_service_spec.rb
+3
-0
spec/services/issue_links/list_service_spec.rb
spec/services/issue_links/list_service_spec.rb
+3
-0
No files found.
app/models/license.rb
View file @
cc441566
...
...
@@ -6,11 +6,13 @@ class License < ActiveRecord::Base
GEO_FEATURE
=
'GitLab_Geo'
.
freeze
AUDITOR_USER_FEATURE
=
'GitLab_Auditor_User'
.
freeze
SERVICE_DESK_FEATURE
=
'GitLab_ServiceDesk'
.
freeze
RELATED_ISSUES_FEATURE
=
'RelatedIssues'
.
freeze
FEATURE_CODES
=
{
geo:
GEO_FEATURE
,
auditor_user:
AUDITOR_USER_FEATURE
,
service_desk:
SERVICE_DESK_FEATURE
,
related_issues:
RELATED_ISSUES_FEATURE
,
# Features that make sense to Namespace:
deploy_board:
DEPLOY_BOARD_FEATURE
,
file_lock:
FILE_LOCK_FEATURE
...
...
@@ -22,7 +24,7 @@ class License < ActiveRecord::Base
EARLY_ADOPTER_PLAN
=
'early_adopter'
.
freeze
EES_FEATURES
=
[
# ..
{
RELATED_ISSUES_FEATURE
=>
1
},
].
freeze
EEP_FEATURES
=
[
...
...
app/policies/ee/project_policy.rb
View file @
cc441566
...
...
@@ -22,6 +22,11 @@ module EE
cannot!
:create_note
cannot!
:read_project
end
unless
License
.
current
&
.
feature_available?
(
:related_issues
)
cannot!
:read_issue_link
cannot!
:admin_issue_link
end
end
end
end
spec/controllers/projects/issue_links_controller_spec.rb
View file @
cc441566
...
...
@@ -5,6 +5,11 @@ describe Projects::IssueLinksController, type: :controller do
let
(
:project
)
{
create
(
:project_empty_repo
)
}
let
(
:issue
)
{
create
:issue
,
project:
project
}
before
do
allow_any_instance_of
(
License
).
to
receive
(
:feature_available?
)
{
false
}
allow_any_instance_of
(
License
).
to
receive
(
:feature_available?
).
with
(
:related_issues
)
{
true
}
end
describe
'GET #index'
do
let
(
:service
)
{
double
(
IssueLinks
::
ListService
,
execute:
service_response
)
}
let
(
:service_response
)
{
[{
'foo'
=>
'bar'
}]
}
...
...
spec/services/issue_links/create_service_spec.rb
View file @
cc441566
...
...
@@ -11,6 +11,9 @@ describe IssueLinks::CreateService, service: true do
end
before
do
allow_any_instance_of
(
License
).
to
receive
(
:feature_available?
)
{
false
}
allow_any_instance_of
(
License
).
to
receive
(
:feature_available?
).
with
(
:related_issues
)
{
true
}
project
.
team
<<
[
user
,
:developer
]
end
...
...
spec/services/issue_links/list_service_spec.rb
View file @
cc441566
...
...
@@ -7,6 +7,9 @@ describe IssueLinks::ListService, service: true do
let
(
:user_role
)
{
:developer
}
before
do
allow_any_instance_of
(
License
).
to
receive
(
:feature_available?
)
{
false
}
allow_any_instance_of
(
License
).
to
receive
(
:feature_available?
).
with
(
:related_issues
)
{
true
}
project
.
team
<<
[
user
,
user_role
]
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