Skip to content

Commit

Permalink
[KNOWAGE-8206] Skipped QBE role check during creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Redjaw committed Aug 5, 2024
1 parent 81241b6 commit 37bb48c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
</template>
<knMonaco v-model="qbeQuery" style="height: 100%" :options="{ readOnly: true }" language="sql"></knMonaco>
</Dialog>
<QBE v-if="qbeVisible" :visible="qbeVisible" :dataset="qbeDataset" :return-query-mode="true" :get-query-from-dataset-prop="getQueryFromDataset" @querySaved="onQbeDialogSave" @close="onQbeDialogClose" />
<QBE v-if="qbeVisible" :visible="qbeVisible" :dataset="qbeDataset" :return-query-mode="true" :from-ds-management="true" :get-query-from-dataset-prop="getQueryFromDataset" @querySaved="onQbeDialogSave" @close="onQbeDialogClose" />
</template>

<script lang="ts">
Expand Down
58 changes: 30 additions & 28 deletions src/modules/qbe/QBE.vue
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export default defineComponent({
KnCalculatedField,
Dropdown
},
props: { visible: { type: Boolean }, dataset: { type: Object }, returnQueryMode: { type: Boolean }, getQueryFromDatasetProp: { type: Boolean }, sourceDataset: { type: Object } },
props: { visible: { type: Boolean }, dataset: { type: Object }, returnQueryMode: { type: Boolean }, getQueryFromDatasetProp: { type: Boolean }, sourceDataset: { type: Object }, fromDsManagement: { type: Boolean, default: false } },
emits: ['close', 'querySaved'],
setup() {
const store = mainStore()
Expand Down Expand Up @@ -317,37 +317,39 @@ export default defineComponent({

let invalidRole = false
const dataset = this.dataset ?? this.sourceDataset
getCorrectRolesForExecution(null, dataset)
.then(async (response: any) => {
const correctRolesForExecution = response
if (!this.fromDsManagement) {
getCorrectRolesForExecution(null, dataset)
.then(async (response: any) => {
const correctRolesForExecution = response

if (!this.userRole) {
if (correctRolesForExecution.length == 1) {
this.userRole = correctRolesForExecution[0]
} else {
this.parameterSidebarVisible = true
}
} else if (this.userRole) {
if (correctRolesForExecution.length == 1) {
const correctRole = correctRolesForExecution[0]
if (this.userRole !== correctRole) {
this.$store.commit('setError', {
title: this.$t('common.error.generic'),
msg: this.$t('documentExecution.main.userRoleError')
})
invalidRole = true
if (!this.userRole) {
if (correctRolesForExecution.length == 1) {
this.userRole = correctRolesForExecution[0]
} else {
this.parameterSidebarVisible = true
}
} else if (this.userRole) {
if (correctRolesForExecution.length == 1) {
const correctRole = correctRolesForExecution[0]
if (this.userRole !== correctRole) {
this.$store.commit('setError', {
title: this.$t('common.error.generic'),
msg: this.$t('documentExecution.main.userRoleError')
})
invalidRole = true
}
}
}
}
if (!invalidRole) {
if (this.userRole) {
await this.loadPage()
} else {
this.parameterSidebarVisible = true
if (!invalidRole) {
if (this.userRole) {
await this.loadPage()
} else {
this.parameterSidebarVisible = true
}
}
}
})
.catch(() => this.$emit('close'))
})
.catch(() => this.$emit('close'))
} else await this.loadPage()
},
methods: {
//#region ===================== Load QBE and format data ====================================================
Expand Down

0 comments on commit 37bb48c

Please sign in to comment.