fix: team environment user access bug (#5149)

This commit is contained in:
Nivedin 2025-06-13 14:29:27 +05:30 committed by GitHub
parent 9ef2c461ba
commit 5049f6fde7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 19 deletions

View file

@ -35,7 +35,6 @@
:placeholder="`${t('action.search')}`"
:context-menu-enabled="false"
class="border border-dividerDark focus:border-primaryDark rounded"
:readonly="isFilterInputDisabled"
/>
<HoppSmartItem
v-if="!isScopeSelector"
@ -701,14 +700,6 @@ const editGlobalEnv = () => {
invokeAction("modals.global.environment.update", {})
}
// Filter input disabled if no environments are available
const isFilterInputDisabled = computed(() => {
if (selectedEnvTab.value === "my-environments") {
return myEnvironments.value.length === 0
}
return teamEnvironmentList.value.length === 0
})
const editEnv = () => {
if (selectedEnv.value.type === "MY_ENV" && selectedEnv.value.name) {
invokeAction("modals.my.environment.edit", {

View file

@ -6,7 +6,6 @@
autocomplete="off"
class="flex w-full bg-transparent px-4 py-2 h-8 border-b border-dividerLight"
:placeholder="t('action.search')"
:disabled="!environments.length"
/>
<div
class="sticky top-upperPrimaryStickyFold z-10 flex flex-1 flex-shrink-0 justify-between overflow-x-auto border-b border-dividerLight bg-primary"

View file

@ -88,7 +88,10 @@
:placeholder="`${t('count.variable', {
count: index + 1,
})}`"
:name="'param' + index"
:class="{
'opacity-25': isViewer,
}"
:name="'variable' + index"
:disabled="isViewer"
/>
<SmartEnvInput
@ -100,6 +103,7 @@
:select-text-on-mount="
env.key ? env.key === editingVariableName : false
"
:readonly="isViewer"
/>
<SmartEnvInput
v-model="env.currentValue"
@ -495,8 +499,13 @@ const saveEnvironment = async () => {
secretVariables
)
currentEnvironmentValueService.addEnvironment(
editingID.value,
nonSecretVariables
)
// If the user is a viewer, we don't need to update the environment in BE
// just update the secret environment in the local storage
// just update the secret environment and current environment in the local storage
if (props.isViewer) {
hideModal()
toast.success(`${t("environment.updated")}`)
@ -521,12 +530,6 @@ const saveEnvironment = async () => {
toast.success(`${t("environment.updated")}`)
isLoading.value = false
if (editingID.value) {
currentEnvironmentValueService.addEnvironment(
editingID.value,
nonSecretVariables
)
}
}
)
)()

View file

@ -6,7 +6,7 @@
autocomplete="off"
class="flex w-full bg-transparent px-4 py-2 h-8 border-b border-dividerLight"
:placeholder="t('action.search')"
:disabled="loading || !teamEnvironments.length"
:disabled="loading"
/>
<div
class="sticky top-upperPrimaryStickyFold z-10 flex flex-1 flex-shrink-0 justify-between overflow-x-auto border-b border-dividerLight bg-primary"