mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
178 lines
4.2 KiB
178 lines
4.2 KiB
4 years ago
|
<template>
|
||
|
<div>
|
||
|
<v-toolbar flat height="42" class="toolbar-border-bottom">
|
||
|
<v-toolbar-title>
|
||
3 years ago
|
<v-breadcrumbs
|
||
|
:items="[{
|
||
|
text: nodes.env,
|
||
|
disabled: true,
|
||
|
href: '#'
|
||
|
},{
|
||
|
text: nodes.dbAlias,
|
||
|
disabled: true,
|
||
|
href: '#'
|
||
|
},
|
||
|
{
|
||
|
text: (nodes.procedure_name) + ' (ACL)',
|
||
|
disabled: true,
|
||
|
href: '#'
|
||
|
}]"
|
||
|
divider=">"
|
||
|
small
|
||
|
>
|
||
|
<template #divider>
|
||
|
<v-icon small color="grey lighten-2">
|
||
|
forward
|
||
|
</v-icon>
|
||
4 years ago
|
</template>
|
||
|
</v-breadcrumbs>
|
||
|
</v-toolbar-title>
|
||
3 years ago
|
<v-spacer />
|
||
|
<x-btn
|
||
|
v-ge="['acl','reload']"
|
||
|
outlined
|
||
|
tooltip="Reload ACL"
|
||
|
color="primary"
|
||
|
small
|
||
|
@click="loadAcl"
|
||
4 years ago
|
>
|
||
3 years ago
|
<v-icon small left>
|
||
|
refresh
|
||
|
</v-icon>
|
||
4 years ago
|
Reload
|
||
|
</x-btn>
|
||
|
|
||
3 years ago
|
<x-btn
|
||
|
v-ge="['acl','save']"
|
||
|
outlined
|
||
3 years ago
|
:tooltip="$t('tooltip.saveChanges')"
|
||
3 years ago
|
color="primary"
|
||
|
class="primary"
|
||
|
small
|
||
|
:disabled="!edited"
|
||
|
@click="save"
|
||
4 years ago
|
>
|
||
3 years ago
|
<v-icon small left>
|
||
|
save
|
||
|
</v-icon>
|
||
3 years ago
|
<!-- Save -->
|
||
|
{{ $t('general.save') }}
|
||
4 years ago
|
</x-btn>
|
||
|
</v-toolbar>
|
||
|
|
||
3 years ago
|
<v-simple-table>
|
||
4 years ago
|
<thead>
|
||
3 years ago
|
<tr>
|
||
|
<th />
|
||
|
<th v-for="role in roles" :key="role">
|
||
|
{{ role }}
|
||
|
</th>
|
||
|
</tr>
|
||
4 years ago
|
</thead>
|
||
|
<tbody>
|
||
3 years ago
|
<tr>
|
||
|
<th>{{ nodes.procedure_name }}</th>
|
||
|
<th v-for="role in roles" :key="role" class="permission-checkbox-container">
|
||
|
<v-checkbox
|
||
|
v-model="data[role]"
|
||
|
dense
|
||
|
hide-details
|
||
|
@change="edited=true"
|
||
|
/>
|
||
|
</th>
|
||
|
</tr>
|
||
4 years ago
|
</tbody>
|
||
|
</v-simple-table>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
3 years ago
|
name: 'ProcedureAcl',
|
||
|
props: ['nodes'],
|
||
4 years ago
|
data: () => ({
|
||
|
loading: false,
|
||
|
edited: false,
|
||
|
data: null
|
||
|
}),
|
||
3 years ago
|
computed: {
|
||
3 years ago
|
roles() {
|
||
3 years ago
|
return this.data ? Object.keys(this.data) : []
|
||
|
}
|
||
|
},
|
||
3 years ago
|
async created() {
|
||
4 years ago
|
await this.loadAcl()
|
||
|
},
|
||
|
methods: {
|
||
3 years ago
|
async loadAcl() {
|
||
3 years ago
|
this.loading = true
|
||
4 years ago
|
const result = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
|
||
|
env: this.nodes.env,
|
||
|
dbAlias: this.nodes.dbAlias
|
||
|
}, 'xcAclGet', {
|
||
|
name: this.nodes.procedure_name
|
||
3 years ago
|
}])
|
||
|
this.data = JSON.parse(result.acl)
|
||
4 years ago
|
|
||
3 years ago
|
this.loading = false
|
||
4 years ago
|
},
|
||
3 years ago
|
async save() {
|
||
4 years ago
|
try {
|
||
|
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
|
||
|
env: this.nodes.env,
|
||
|
dbAlias: this.nodes.dbAlias
|
||
|
}, 'xcAclSave', {
|
||
|
name: this.nodes.procedure_name,
|
||
|
acl: this.data
|
||
3 years ago
|
}])
|
||
|
this.$toast.success('ACL saved successfully').goAway(3000)
|
||
|
this.edited = false
|
||
4 years ago
|
await this.loadAcl()
|
||
|
} catch (e) {
|
||
3 years ago
|
this.$toast.error('Some error occurred').goAway(3000)
|
||
4 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style scoped lang="scss">
|
||
|
|
||
|
::v-deep {
|
||
|
.permission-checkbox-container .v-input {
|
||
|
transform: scale(.8);
|
||
|
margin-top: 0;
|
||
|
}
|
||
|
|
||
|
.v-overlay__content {
|
||
|
height: 100%;
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
}
|
||
|
}
|
||
|
</style>
|
||
|
<!--
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||
|
*
|
||
|
* @author Naveen MR <oof1lab@gmail.com>
|
||
|
* @author Pranav C Balan <pranavxc@gmail.com>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|