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
0cde6bfe
Commit
0cde6bfe
authored
Mar 13, 2019
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract EE specific files/lines for Release app/serializers
ok
parent
50b922ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
app/serializers/environment_entity.rb
app/serializers/environment_entity.rb
+2
-6
ee/app/serializers/ee/environment_entity.rb
ee/app/serializers/ee/environment_entity.rb
+6
-0
No files found.
app/serializers/environment_entity.rb
View file @
0cde6bfe
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
class
EnvironmentEntity
<
Grape
::
Entity
class
EnvironmentEntity
<
Grape
::
Entity
include
RequestAwareEntity
include
RequestAwareEntity
prepend
::
EE
::
EnvironmentEntity
# rubocop: disable Cop/InjectEnterpriseEditionModule
expose
:id
expose
:id
expose
:name
expose
:name
...
@@ -12,7 +11,6 @@ class EnvironmentEntity < Grape::Entity
...
@@ -12,7 +11,6 @@ class EnvironmentEntity < Grape::Entity
expose
:name_without_type
expose
:name_without_type
expose
:last_deployment
,
using:
DeploymentEntity
expose
:last_deployment
,
using:
DeploymentEntity
expose
:stop_action_available?
,
as: :has_stop_action
expose
:stop_action_available?
,
as: :has_stop_action
expose
:rollout_status
,
if:
->
(
*
)
{
can_read_deploy_board?
},
using:
RolloutStatusEntity
expose
:metrics_path
,
if:
->
(
*
)
{
environment
.
has_metrics?
}
do
|
environment
|
expose
:metrics_path
,
if:
->
(
*
)
{
environment
.
has_metrics?
}
do
|
environment
|
metrics_project_environment_path
(
environment
.
project
,
environment
)
metrics_project_environment_path
(
environment
.
project
,
environment
)
...
@@ -52,10 +50,6 @@ class EnvironmentEntity < Grape::Entity
...
@@ -52,10 +50,6 @@ class EnvironmentEntity < Grape::Entity
request
.
current_user
request
.
current_user
end
end
def
can_read_deploy_board?
can?
(
current_user
,
:read_deploy_board
,
environment
.
project
)
end
def
can_access_terminal?
def
can_access_terminal?
can?
(
request
.
current_user
,
:create_environment_terminal
,
environment
)
can?
(
request
.
current_user
,
:create_environment_terminal
,
environment
)
end
end
...
@@ -72,3 +66,5 @@ class EnvironmentEntity < Grape::Entity
...
@@ -72,3 +66,5 @@ class EnvironmentEntity < Grape::Entity
deployment_platform
.
cluster
deployment_platform
.
cluster
end
end
end
end
EnvironmentEntity
.
prepend
(
::
EE
::
EnvironmentEntity
)
ee/app/serializers/ee/environment_entity.rb
View file @
0cde6bfe
...
@@ -6,6 +6,8 @@ module EE
...
@@ -6,6 +6,8 @@ module EE
extend
::
Gitlab
::
Utils
::
Override
extend
::
Gitlab
::
Utils
::
Override
prepended
do
prepended
do
expose
:rollout_status
,
if:
->
(
*
)
{
can_read_deploy_board?
},
using:
::
RolloutStatusEntity
expose
:logs_path
,
if:
->
(
*
)
{
can_read_pod_logs?
}
do
|
environment
|
expose
:logs_path
,
if:
->
(
*
)
{
can_read_pod_logs?
}
do
|
environment
|
logs_project_environment_path
(
environment
.
project
,
environment
)
logs_project_environment_path
(
environment
.
project
,
environment
)
end
end
...
@@ -16,5 +18,9 @@ module EE
...
@@ -16,5 +18,9 @@ module EE
def
can_read_pod_logs?
def
can_read_pod_logs?
can?
(
current_user
,
:read_pod_logs
,
environment
.
project
)
can?
(
current_user
,
:read_pod_logs
,
environment
.
project
)
end
end
def
can_read_deploy_board?
can?
(
current_user
,
:read_deploy_board
,
environment
.
project
)
end
end
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