mirror of https://github.com/nocodb/nocodb
177 lines
4.6 KiB
177 lines
4.6 KiB
3 years ago
|
<!-- eslint-disable -->
|
||
4 years ago
|
<template>
|
||
|
<div>
|
||
|
<v-card style="">
|
||
|
<v-toolbar flat height="42" class="toolbar-border-bottom">
|
||
|
<v-toolbar-title>
|
||
3 years ago
|
<v-breadcrumbs
|
||
3 years ago
|
:items="[
|
||
|
{
|
||
|
text: nodes.env,
|
||
|
disabled: true,
|
||
|
href: '#',
|
||
|
},
|
||
|
{
|
||
|
text: nodes.dbAlias,
|
||
|
disabled: true,
|
||
|
href: '#',
|
||
|
},
|
||
|
{
|
||
|
text: nodes.table_name + ' (ACL)',
|
||
|
disabled: true,
|
||
|
href: '#',
|
||
|
},
|
||
|
]"
|
||
3 years ago
|
divider=">"
|
||
|
small
|
||
|
>
|
||
|
<template #divider>
|
||
3 years ago
|
<v-icon small color="grey lighten-2"> forward </v-icon>
|
||
4 years ago
|
</template>
|
||
|
</v-breadcrumbs>
|
||
|
</v-toolbar-title>
|
||
3 years ago
|
<v-spacer />
|
||
3 years ago
|
<x-btn v-ge="['acl', 'reload']" outlined tooltip="Reload ACL" color="primary" small @click="reload">
|
||
|
<v-icon small left> refresh </v-icon>
|
||
3 years ago
|
<!-- Reload -->
|
||
|
{{ $t('general.reload') }}
|
||
4 years ago
|
</x-btn>
|
||
3 years ago
|
<x-btn
|
||
3 years ago
|
v-ge="['acl', 'open-folder']"
|
||
3 years ago
|
tooltip="Open Corresponding Folder"
|
||
|
icon="mdi-folder-open"
|
||
|
outlined
|
||
|
small
|
||
|
:disabled="!policyPaths || !policyPaths.length"
|
||
|
color="primary"
|
||
|
@click="openFolder"
|
||
|
>
|
||
4 years ago
|
Open Folder
|
||
|
</x-btn>
|
||
3 years ago
|
<x-btn
|
||
3 years ago
|
v-ge="['acl', 'save']"
|
||
3 years ago
|
outlined
|
||
3 years ago
|
:tooltip="$t('tooltip.saveChanges')"
|
||
3 years ago
|
color="primary"
|
||
|
class="primary"
|
||
|
small
|
||
|
:disabled="disableSaveButton"
|
||
|
@click="save"
|
||
|
>
|
||
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-text-field
|
||
|
v-model="search"
|
||
|
dense
|
||
|
hide-details
|
||
|
class="ma-2"
|
||
3 years ago
|
:placeholder="`Search ${nodes.table_name} routes`"
|
||
3 years ago
|
prepend-inner-icon="search"
|
||
|
outlined
|
||
|
/>
|
||
4 years ago
|
|
||
|
<acl-ts-file-child
|
||
3 years ago
|
v-for="(policyPath, k) in policyPaths"
|
||
4 years ago
|
:key="k"
|
||
3 years ago
|
ref="acl"
|
||
|
style="border-bottom: 1px solid grey"
|
||
|
:nodes="nodes"
|
||
|
:search="search"
|
||
|
:policy-path="policyPath"
|
||
|
/>
|
||
4 years ago
|
|
||
3 years ago
|
<v-alert v-if="policyPaths && !policyPaths.length" outlined type="info"> Permission file not found </v-alert>
|
||
4 years ago
|
</v-card>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
3 years ago
|
import { mapGetters } from 'vuex';
|
||
|
import aclTsFileChild from './AclTsFileChild';
|
||
4 years ago
|
|
||
3 years ago
|
// const {shell, path} = require("electron").remote.require('./libs');
|
||
4 years ago
|
|
||
3 years ago
|
export default {
|
||
|
name: 'AclTypeorm',
|
||
|
components: { aclTsFileChild },
|
||
|
props: ['nodes'],
|
||
3 years ago
|
data() {
|
||
3 years ago
|
return {
|
||
|
policyPaths: null,
|
||
3 years ago
|
search: '',
|
||
|
};
|
||
3 years ago
|
},
|
||
|
methods: {
|
||
3 years ago
|
async aclInit() {
|
||
3 years ago
|
// this.disableSaveButton = true;
|
||
|
// this.policyPaths = await this.sqlMgr.projectGetTsPolicyPath({
|
||
|
// env: this.nodes.env,
|
||
|
// dbAlias: this.nodes.dbAlias,
|
||
3 years ago
|
// tn: this.nodes.table_name
|
||
3 years ago
|
// });
|
||
4 years ago
|
|
||
3 years ago
|
this.policyPaths = await this.$store.dispatch('sqlMgr/ActSqlOp', [
|
||
|
{
|
||
|
env: this.nodes.env,
|
||
|
dbAlias: this.nodes.dbAlias,
|
||
|
},
|
||
|
'projectGetTsPolicyPath',
|
||
|
{
|
||
|
table_name: this.nodes.table_name,
|
||
|
},
|
||
|
]);
|
||
4 years ago
|
},
|
||
3 years ago
|
reload() {
|
||
3 years ago
|
for (const $acl of this.$refs.acl) {
|
||
3 years ago
|
$acl.aclInit();
|
||
4 years ago
|
}
|
||
|
},
|
||
3 years ago
|
save() {
|
||
3 years ago
|
for (const $acl of this.$refs.acl) {
|
||
3 years ago
|
$acl.save();
|
||
3 years ago
|
}
|
||
4 years ago
|
},
|
||
3 years ago
|
openFolder() {
|
||
3 years ago
|
// shell.openItem(path.dirname(this.policyPaths[0]));
|
||
3 years ago
|
},
|
||
3 years ago
|
},
|
||
|
computed: {
|
||
3 years ago
|
...mapGetters({ sqlMgr: 'sqlMgr/sqlMgr' }),
|
||
3 years ago
|
},
|
||
|
watch: {},
|
||
3 years ago
|
async created() {
|
||
3 years ago
|
await this.aclInit();
|
||
|
},
|
||
|
};
|
||
4 years ago
|
</script>
|
||
|
|
||
3 years ago
|
<style scoped></style>
|
||
4 years ago
|
<!--
|
||
|
/**
|
||
|
* @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/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|