diff --git a/src/components/AddSheet.vue b/src/components/AddSheet.vue index a1dead4..a728480 100644 --- a/src/components/AddSheet.vue +++ b/src/components/AddSheet.vue @@ -35,10 +35,11 @@ Quota and rules for group {{ group }}: @@ -101,7 +103,10 @@ export default { return this.sheetName && this.spreadsheetId && this.availableGroups?.some(g => g.value === this.group) && this.availableFrequencies?.some(f => f === this.frequency) && !this.maxedOutGroupQuota; }, availableGroups() { - return (this.$store.state.user?.groups || []).map(g => ({ title: g, value: g })); + const permissions = this.$store.state.user?.permissions || {}; + return Object.keys(permissions) + .filter(group => group !== "all" && permissions[group].archive_sheet) + .map(g => ({ title: g, value: g })); }, availableFrequencies() { return this.$store.state.user?.permissions?.[this.group]?.sheet_frequency || []; @@ -112,7 +117,8 @@ export default { groupUsage() { return this.$store.state.user?.usage?.["groups"]?.[this.group] || {}; }, - maxedOutGroupQuota(){ + maxedOutGroupQuota() { + if (this.groupPermissions?.archive_sheet === false) return true; if (this.groupPermissions.max_sheets === -1) return false; return this.groupUsage.total_sheets >= this.groupPermissions.max_sheets; }, diff --git a/src/views/ArchiveUrlView.vue b/src/views/ArchiveUrlView.vue index e52299c..fc24ec8 100644 --- a/src/views/ArchiveUrlView.vue +++ b/src/views/ArchiveUrlView.vue @@ -92,8 +92,6 @@ export default { }, data() { return { - availableGroups: [{ title: "only me", value: "" }].concat((this.$store.state.user?.groups || []).map(g => ({ title: g, value: g }))), - url: "", public: true, group: "", @@ -124,6 +122,14 @@ export default { validUrl() { return this.url && this.urlValidator(this.url) === true; }, + availableGroups() { + const permissions = this.$store.state.user?.permissions || {}; + return [{ title: "only me", value: "" }].concat( + Object.keys(permissions) + .filter(group => group !== "all" && permissions[group].archive_url) + .map(g => ({ title: g, value: g })) + ); + }, globalUsage() { return this.$store.state.user?.usage || {}; },