backupsite: only owner can add a site
This commit is contained in:
@@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
|
||||
const i18n = useI18n();
|
||||
const t = i18n.t;
|
||||
|
||||
import { ref, onMounted, useTemplateRef, reactive } from 'vue';
|
||||
import { ref, onMounted, useTemplateRef, reactive, inject } from 'vue';
|
||||
import { Button, Menu, ProgressBar, InputDialog } from '@cloudron/pankow';
|
||||
import { prettyLongDate } from '@cloudron/pankow/utils';
|
||||
import Section from '../components/Section.vue';
|
||||
@@ -16,18 +16,17 @@ import BackupSiteConfigDialog from '../components/BackupSiteConfigDialog.vue';
|
||||
import SystemBackupList from '../components/SystemBackupList.vue';
|
||||
import { TASK_TYPES } from '../constants.js';
|
||||
import BackupSitesModel from '../models/BackupSitesModel.js';
|
||||
import ProfileModel from '../models/ProfileModel.js';
|
||||
import TasksModel from '../models/TasksModel.js';
|
||||
import { cronDays, cronHours, regionName } from '../utils.js';
|
||||
|
||||
const profileModel = ProfileModel.create();
|
||||
const profile = inject('profile');
|
||||
|
||||
const tasksModel = TasksModel.create();
|
||||
const backupSitesModels = BackupSitesModel.create();
|
||||
|
||||
const inputDialog = useTemplateRef('inputDialog');
|
||||
const systemBackupList = useTemplateRef('systemBackupList');
|
||||
|
||||
const profile = ref({});
|
||||
const sites = ref([]);
|
||||
const busy = ref(true);
|
||||
|
||||
@@ -253,11 +252,6 @@ async function refresh() {
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
const [error, result] = await profileModel.get();
|
||||
if (error) return console.error(error);
|
||||
|
||||
profile.value = result;
|
||||
|
||||
await refresh();
|
||||
});
|
||||
|
||||
@@ -274,7 +268,7 @@ onMounted(async () => {
|
||||
|
||||
<Section :title="$t('backup.sites.title')">
|
||||
<template #header-buttons>
|
||||
<Button @click="onAdd()"> {{ $t('main.action.add') }}</Button>
|
||||
<Button v-if="profile.isAtLeastOwner" @click="onAdd()"> {{ $t('main.action.add') }}</Button>
|
||||
</template>
|
||||
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user