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
727830ed
Commit
727830ed
authored
Aug 31, 2021
by
Allen Cook
Committed by
Jacques Erasmus
Aug 31, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move read permission check for environments to backend
parent
6f2ab170
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
7 additions
and
73 deletions
+7
-73
app/assets/javascripts/environments/components/container.vue
app/assets/javascripts/environments/components/container.vue
+1
-5
app/assets/javascripts/environments/components/environment_item.vue
.../javascripts/environments/components/environment_item.vue
+2
-8
app/assets/javascripts/environments/components/environments_app.vue
.../javascripts/environments/components/environments_app.vue
+0
-5
app/assets/javascripts/environments/components/environments_detail_header.vue
...ts/environments/components/environments_detail_header.vue
+2
-6
app/assets/javascripts/environments/components/environments_table.vue
...avascripts/environments/components/environments_table.vue
+0
-7
app/assets/javascripts/environments/folder/environments_folder_bundle.js
...scripts/environments/folder/environments_folder_bundle.js
+0
-3
app/assets/javascripts/environments/folder/environments_folder_view.vue
...ascripts/environments/folder/environments_folder_view.vue
+0
-5
app/assets/javascripts/environments/index.js
app/assets/javascripts/environments/index.js
+0
-2
app/assets/javascripts/environments/mount_show.js
app/assets/javascripts/environments/mount_show.js
+0
-1
app/helpers/environment_helper.rb
app/helpers/environment_helper.rb
+0
-1
ee/spec/frontend/environments/environments_app_spec.js
ee/spec/frontend/environments/environments_app_spec.js
+0
-1
ee/spec/frontend/environments/environments_table_spec.js
ee/spec/frontend/environments/environments_table_spec.js
+0
-1
spec/frontend/environments/environment_item_spec.js
spec/frontend/environments/environment_item_spec.js
+0
-7
spec/frontend/environments/environment_table_spec.js
spec/frontend/environments/environment_table_spec.js
+0
-11
spec/frontend/environments/environments_app_spec.js
spec/frontend/environments/environments_app_spec.js
+0
-1
spec/frontend/environments/environments_detail_header_spec.js
.../frontend/environments/environments_detail_header_spec.js
+2
-6
spec/frontend/environments/environments_folder_view_spec.js
spec/frontend/environments/environments_folder_view_spec.js
+0
-1
spec/frontend/environments/folder/environments_folder_view_spec.js
...tend/environments/folder/environments_folder_view_spec.js
+0
-1
spec/helpers/environment_helper_spec.rb
spec/helpers/environment_helper_spec.rb
+0
-1
No files found.
app/assets/javascripts/environments/components/container.vue
View file @
727830ed
...
...
@@ -22,10 +22,6 @@ export default {
type
:
Object
,
required
:
true
,
},
canReadEnvironment
:
{
type
:
Boolean
,
required
:
true
,
},
},
methods
:
{
onChangePage
(
page
)
{
...
...
@@ -42,7 +38,7 @@ export default {
<slot
name=
"empty-state"
></slot>
<div
v-if=
"!isLoading && environments.length > 0"
class=
"table-holder"
>
<environment-table
:environments=
"environments"
:can-read-environment=
"canReadEnvironment"
/>
<environment-table
:environments=
"environments"
/>
<table-pagination
v-if=
"pagination && pagination.totalPages > 1"
...
...
app/assets/javascripts/environments/components/environment_item.vue
View file @
727830ed
...
...
@@ -48,12 +48,6 @@ export default {
mixins
:
[
timeagoMixin
],
props
:
{
canReadEnvironment
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
model
:
{
type
:
Object
,
required
:
true
,
...
...
@@ -790,14 +784,14 @@ export default {
/>
<external-url-component
v-if=
"externalURL
&& canReadEnvironment
"
v-if=
"externalURL"
:external-url=
"externalURL"
data-track-action=
"click_button"
data-track-label=
"environment_url"
/>
<monitoring-button-component
v-if=
"monitoringUrl
&& canReadEnvironment
"
v-if=
"monitoringUrl"
:monitoring-url=
"monitoringUrl"
data-track-action=
"click_button"
data-track-label=
"environment_monitoring"
...
...
app/assets/javascripts/environments/components/environments_app.vue
View file @
727830ed
...
...
@@ -52,10 +52,6 @@ export default {
type
:
Boolean
,
required
:
true
,
},
canReadEnvironment
:
{
type
:
Boolean
,
required
:
true
,
},
newEnvironmentPath
:
{
type
:
String
,
required
:
true
,
...
...
@@ -210,7 +206,6 @@ export default {
:is-loading=
"isLoading"
:environments=
"state.environments"
:pagination=
"state.paginationInformation"
:can-read-environment=
"canReadEnvironment"
@
onChangePage=
"onChangePage"
>
<
template
v-if=
"!isLoading && state.environments.length === 0"
#empty-state
>
...
...
app/assets/javascripts/environments/components/environments_detail_header.vue
View file @
727830ed
...
...
@@ -27,10 +27,6 @@ export default {
type
:
Object
,
required
:
true
,
},
canReadEnvironment
:
{
type
:
Boolean
,
required
:
true
,
},
canAdminEnvironment
:
{
type
:
Boolean
,
required
:
true
,
...
...
@@ -84,7 +80,7 @@ export default {
return
this
.
environment
.
isAvailable
&&
Boolean
(
this
.
environment
.
autoStopAt
);
},
shouldShowExternalUrlButton
()
{
return
this
.
canReadEnvironment
&&
Boolean
(
this
.
environment
.
externalUrl
);
return
Boolean
(
this
.
environment
.
externalUrl
);
},
shouldShowStopButton
()
{
return
this
.
canStopEnvironment
&&
this
.
environment
.
isAvailable
;
...
...
@@ -138,7 +134,7 @@ export default {
>
{{ $options.i18n.externalButtonText }}
</gl-button
>
<gl-button
v-if=
"
canReadEnvironment
"
v-if=
"
shouldShowExternalUrlButton
"
data-testid=
"metrics-button"
:href=
"metricsPath"
:title=
"$options.i18n.metricsButtonTitle"
...
...
app/assets/javascripts/environments/components/environments_table.vue
View file @
727830ed
...
...
@@ -23,11 +23,6 @@ export default {
required
:
true
,
default
:
()
=>
[],
},
canReadEnvironment
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
},
data
()
{
return
{
...
...
@@ -155,7 +150,6 @@ export default {
<environment-item
:key=
"`environment-item-$
{i}`"
:model="model"
:can-read-environment="canReadEnvironment"
:table-data="tableData"
data-qa-selector="environment_item"
/>
...
...
@@ -191,7 +185,6 @@ export default {
<environment-item
:key=
"`environment-row-$
{i}-${index}`"
:model="child"
:can-read-environment="canReadEnvironment"
:table-data="tableData"
data-qa-selector="environment_item"
/>
...
...
app/assets/javascripts/environments/folder/environments_folder_bundle.js
View file @
727830ed
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
{
parseBoolean
}
from
'
../../lib/utils/common_utils
'
;
import
Translate
from
'
../../vue_shared/translate
'
;
import
environmentsFolderApp
from
'
./environments_folder_view.vue
'
;
...
...
@@ -31,7 +30,6 @@ export default () => {
endpoint
:
environmentsData
.
environmentsDataEndpoint
,
folderName
:
environmentsData
.
environmentsDataFolderName
,
cssContainerClass
:
environmentsData
.
cssClass
,
canReadEnvironment
:
parseBoolean
(
environmentsData
.
environmentsDataCanReadEnvironment
),
};
},
render
(
createElement
)
{
...
...
@@ -40,7 +38,6 @@ export default () => {
endpoint
:
this
.
endpoint
,
folderName
:
this
.
folderName
,
cssContainerClass
:
this
.
cssContainerClass
,
canReadEnvironment
:
this
.
canReadEnvironment
,
},
});
},
...
...
app/assets/javascripts/environments/folder/environments_folder_view.vue
View file @
727830ed
...
...
@@ -30,10 +30,6 @@ export default {
required
:
false
,
default
:
''
,
},
canReadEnvironment
:
{
type
:
Boolean
,
required
:
true
,
},
},
methods
:
{
successCallback
(
resp
)
{
...
...
@@ -72,7 +68,6 @@ export default {
:is-loading=
"isLoading"
:environments=
"state.environments"
:pagination=
"state.paginationInformation"
:can-read-environment=
"canReadEnvironment"
@
onChangePage=
"onChangePage"
/>
</div>
...
...
app/assets/javascripts/environments/index.js
View file @
727830ed
...
...
@@ -32,7 +32,6 @@ export default () => {
newEnvironmentPath
:
environmentsData
.
newEnvironmentPath
,
helpPagePath
:
environmentsData
.
helpPagePath
,
canCreateEnvironment
:
parseBoolean
(
environmentsData
.
canCreateEnvironment
),
canReadEnvironment
:
parseBoolean
(
environmentsData
.
canReadEnvironment
),
};
},
render
(
createElement
)
{
...
...
@@ -42,7 +41,6 @@ export default () => {
newEnvironmentPath
:
this
.
newEnvironmentPath
,
helpPagePath
:
this
.
helpPagePath
,
canCreateEnvironment
:
this
.
canCreateEnvironment
,
canReadEnvironment
:
this
.
canReadEnvironment
,
},
});
},
...
...
app/assets/javascripts/environments/mount_show.js
View file @
727830ed
...
...
@@ -36,7 +36,6 @@ export const initHeader = () => {
environment
:
this
.
environment
,
canDestroyEnvironment
:
dataset
.
canDestroyEnvironment
,
canUpdateEnvironment
:
dataset
.
canUpdateEnvironment
,
canReadEnvironment
:
dataset
.
canReadEnvironment
,
canStopEnvironment
:
dataset
.
canStopEnvironment
,
canAdminEnvironment
:
dataset
.
canAdminEnvironment
,
cancelAutoStopPath
:
dataset
.
environmentCancelAutoStopPath
,
...
...
app/helpers/environment_helper.rb
View file @
727830ed
...
...
@@ -73,7 +73,6 @@ module EnvironmentHelper
external_url:
environment
.
external_url
,
can_update_environment:
can?
(
current_user
,
:update_environment
,
environment
),
can_destroy_environment:
can_destroy_environment?
(
environment
),
can_read_environment:
can?
(
current_user
,
:read_environment
,
environment
),
can_stop_environment:
can?
(
current_user
,
:stop_environment
,
environment
),
can_admin_environment:
can?
(
current_user
,
:admin_environment
,
project
),
environment_metrics_path:
environment_metrics_path
(
environment
),
...
...
ee/spec/frontend/environments/environments_app_spec.js
View file @
727830ed
...
...
@@ -11,7 +11,6 @@ describe('Environment', () => {
const
mockData
=
{
canCreateEnvironment
:
true
,
canReadEnvironment
:
true
,
endpoint
:
'
environments.json
'
,
helpCanaryDeploymentsPath
:
'
help/canary-deployments
'
,
helpPagePath
:
'
help
'
,
...
...
ee/spec/frontend/environments/environments_table_spec.js
View file @
727830ed
...
...
@@ -36,7 +36,6 @@ describe('Environment table', () => {
{
propsData
:
{
environments
:
[
mockItem
],
canReadEnvironment
:
true
,
userCalloutsPath
:
'
/callouts
'
,
lockPromotionSvgPath
:
'
/assets/illustrations/lock-promotion.svg
'
,
helpCanaryDeploymentsPath
:
'
help/canary-deployments
'
,
...
...
spec/frontend/environments/environment_item_spec.js
View file @
727830ed
...
...
@@ -31,7 +31,6 @@ describe('Environment item', () => {
factory
({
propsData
:
{
model
:
environment
,
canReadEnvironment
:
true
,
tableData
,
},
});
...
...
@@ -135,7 +134,6 @@ describe('Environment item', () => {
factory
({
propsData
:
{
model
:
environmentWithoutDeployable
,
canReadEnvironment
:
true
,
tableData
,
},
});
...
...
@@ -161,7 +159,6 @@ describe('Environment item', () => {
factory
({
propsData
:
{
model
:
environmentWithoutUpcomingDeployment
,
canReadEnvironment
:
true
,
tableData
,
},
});
...
...
@@ -177,7 +174,6 @@ describe('Environment item', () => {
factory
({
propsData
:
{
model
:
environment
,
canReadEnvironment
:
true
,
tableData
,
shouldShowAutoStopDate
:
true
,
},
...
...
@@ -205,7 +201,6 @@ describe('Environment item', () => {
...
environment
,
auto_stop_at
:
futureDate
,
},
canReadEnvironment
:
true
,
tableData
,
shouldShowAutoStopDate
:
true
,
},
...
...
@@ -241,7 +236,6 @@ describe('Environment item', () => {
...
environment
,
auto_stop_at
:
pastDate
,
},
canReadEnvironment
:
true
,
tableData
,
shouldShowAutoStopDate
:
true
,
},
...
...
@@ -360,7 +354,6 @@ describe('Environment item', () => {
factory
({
propsData
:
{
model
:
folder
,
canReadEnvironment
:
true
,
tableData
,
},
});
...
...
spec/frontend/environments/environment_table_spec.js
View file @
727830ed
...
...
@@ -28,7 +28,6 @@ describe('Environment table', () => {
factory
({
propsData
:
{
environments
:
[
folder
],
canReadEnvironment
:
true
,
...
eeOnlyProps
,
},
});
...
...
@@ -50,7 +49,6 @@ describe('Environment table', () => {
await
factory
({
propsData
:
{
environments
:
[
mockItem
],
canReadEnvironment
:
true
,
userCalloutsPath
:
'
/callouts
'
,
lockPromotionSvgPath
:
'
/assets/illustrations/lock-promotion.svg
'
,
helpCanaryDeploymentsPath
:
'
help/canary-deployments
'
,
...
...
@@ -78,7 +76,6 @@ describe('Environment table', () => {
propsData
:
{
environments
:
[
mockItem
],
canCreateDeployment
:
false
,
canReadEnvironment
:
true
,
userCalloutsPath
:
'
/callouts
'
,
lockPromotionSvgPath
:
'
/assets/illustrations/lock-promotion.svg
'
,
helpCanaryDeploymentsPath
:
'
help/canary-deployments
'
,
...
...
@@ -114,7 +111,6 @@ describe('Environment table', () => {
propsData
:
{
environments
:
[
mockItem
],
canCreateDeployment
:
false
,
canReadEnvironment
:
true
,
userCalloutsPath
:
'
/callouts
'
,
lockPromotionSvgPath
:
'
/assets/illustrations/lock-promotion.svg
'
,
helpCanaryDeploymentsPath
:
'
help/canary-deployments
'
,
...
...
@@ -151,7 +147,6 @@ describe('Environment table', () => {
factory
({
propsData
:
{
environments
:
[
mockItem
],
canReadEnvironment
:
true
,
userCalloutsPath
:
'
/callouts
'
,
lockPromotionSvgPath
:
'
/assets/illustrations/lock-promotion.svg
'
,
helpCanaryDeploymentsPath
:
'
help/canary-deployments
'
,
...
...
@@ -179,7 +174,6 @@ describe('Environment table', () => {
propsData
:
{
environments
:
[
mockItem
],
canCreateDeployment
:
false
,
canReadEnvironment
:
true
,
userCalloutsPath
:
'
/callouts
'
,
lockPromotionSvgPath
:
'
/assets/illustrations/lock-promotion.svg
'
,
helpCanaryDeploymentsPath
:
'
help/canary-deployments
'
,
...
...
@@ -230,7 +224,6 @@ describe('Environment table', () => {
factory
({
propsData
:
{
environments
:
mockItems
,
canReadEnvironment
:
true
,
...
eeOnlyProps
,
},
});
...
...
@@ -296,7 +289,6 @@ describe('Environment table', () => {
factory
({
propsData
:
{
environments
:
mockItems
,
canReadEnvironment
:
true
,
...
eeOnlyProps
,
},
});
...
...
@@ -335,7 +327,6 @@ describe('Environment table', () => {
factory
({
propsData
:
{
environments
:
mockItems
,
canReadEnvironment
:
true
,
...
eeOnlyProps
,
},
});
...
...
@@ -364,7 +355,6 @@ describe('Environment table', () => {
factory
({
propsData
:
{
environments
:
mockItems
,
canReadEnvironment
:
true
,
...
eeOnlyProps
,
},
});
...
...
@@ -415,7 +405,6 @@ describe('Environment table', () => {
factory
({
propsData
:
{
environments
:
mockItems
,
canReadEnvironment
:
true
,
...
eeOnlyProps
,
},
});
...
...
spec/frontend/environments/environments_app_spec.js
View file @
727830ed
...
...
@@ -20,7 +20,6 @@ describe('Environment', () => {
const
mockData
=
{
endpoint
:
'
environments.json
'
,
canCreateEnvironment
:
true
,
canReadEnvironment
:
true
,
newEnvironmentPath
:
'
environments/new
'
,
helpPagePath
:
'
help
'
,
userCalloutsPath
:
'
/callouts
'
,
...
...
spec/frontend/environments/environments_detail_header_spec.js
View file @
727830ed
...
...
@@ -44,7 +44,6 @@ describe('Environments detail header component', () => {
TimeAgo
,
},
propsData
:
{
canReadEnvironment
:
false
,
canAdminEnvironment
:
false
,
canUpdateEnvironment
:
false
,
canStopEnvironment
:
false
,
...
...
@@ -60,7 +59,7 @@ describe('Environments detail header component', () => {
describe
(
'
default state with minimal access
'
,
()
=>
{
beforeEach
(()
=>
{
createWrapper
({
props
:
{
environment
:
createEnvironment
()
}
});
createWrapper
({
props
:
{
environment
:
createEnvironment
(
{
externalUrl
:
null
}
)
}
});
});
it
(
'
displays the environment name
'
,
()
=>
{
...
...
@@ -164,7 +163,6 @@ describe('Environments detail header component', () => {
createWrapper
({
props
:
{
environment
:
createEnvironment
({
hasTerminals
:
true
,
externalUrl
}),
canReadEnvironment
:
true
,
},
});
});
...
...
@@ -178,8 +176,7 @@ describe('Environments detail header component', () => {
beforeEach
(()
=>
{
createWrapper
({
props
:
{
environment
:
createEnvironment
(),
canReadEnvironment
:
true
,
environment
:
createEnvironment
({
metricsUrl
:
'
my metrics url
'
}),
metricsPath
,
},
});
...
...
@@ -195,7 +192,6 @@ describe('Environments detail header component', () => {
createWrapper
({
props
:
{
environment
:
createEnvironment
(),
canReadEnvironment
:
true
,
canAdminEnvironment
:
true
,
canStopEnvironment
:
true
,
canUpdateEnvironment
:
true
,
...
...
spec/frontend/environments/environments_folder_view_spec.js
View file @
727830ed
...
...
@@ -11,7 +11,6 @@ describe('Environments Folder View', () => {
const
mockData
=
{
endpoint
:
'
environments.json
'
,
folderName
:
'
review
'
,
canReadEnvironment
:
true
,
cssContainerClass
:
'
container
'
,
userCalloutsPath
:
'
/callouts
'
,
lockPromotionSvgPath
:
'
/assets/illustrations/lock-promotion.svg
'
,
...
...
spec/frontend/environments/folder/environments_folder_view_spec.js
View file @
727830ed
...
...
@@ -14,7 +14,6 @@ describe('Environments Folder View', () => {
const
mockData
=
{
endpoint
:
'
environments.json
'
,
folderName
:
'
review
'
,
canReadEnvironment
:
true
,
cssContainerClass
:
'
container
'
,
userCalloutsPath
:
'
/callouts
'
,
lockPromotionSvgPath
:
'
/assets/illustrations/lock-promotion.svg
'
,
...
...
spec/helpers/environment_helper_spec.rb
View file @
727830ed
...
...
@@ -43,7 +43,6 @@ RSpec.describe EnvironmentHelper do
external_url:
environment
.
external_url
,
can_update_environment:
true
,
can_destroy_environment:
true
,
can_read_environment:
true
,
can_stop_environment:
true
,
can_admin_environment:
true
,
environment_metrics_path:
environment_metrics_path
(
environment
),
...
...
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