- Frontend restriction alerts

This commit is contained in:
Čarodej
2022-01-05 18:57:02 +01:00
parent 29a954e21b
commit 05f6023053
10 changed files with 108 additions and 12 deletions

View File

@@ -149,6 +149,12 @@ const FunctionHelpers = {
}
Vue.prototype.$uploadFiles = async function (files) {
// Show alert message when upload is disabled
if (! store.getters.user.data.meta.restrictions.canUpload) {
Vue.prototype.$temporarilyDisabledUpload()
return
}
if (files.length === 0) return
@@ -171,6 +177,12 @@ const FunctionHelpers = {
}
Vue.prototype.$uploadDraggedFiles = async function (event, parent_id) {
// Show alert message when upload is disabled
if (! store.getters.user.data.meta.restrictions.canUpload) {
Vue.prototype.$temporarilyDisabledUpload()
return
}
// Prevent submit empty files
if (event.dataTransfer.items.length === 0) return
@@ -258,6 +270,13 @@ const FunctionHelpers = {
}
Vue.prototype.$downloadFile = function (url, filename) {
// Show alert message when download is disabled
if (! store.getters.user.data.meta.restrictions.canDownload) {
Vue.prototype.$temporarilyDisabledDownload()
return
}
var anchor = document.createElement('a')
anchor.href = url
@@ -416,13 +435,6 @@ const FunctionHelpers = {
}
}
Vue.prototype.$isSomethingWrong = function () {
events.$emit('alert:open', {
title: i18n.t('popup_error.title'),
message: i18n.t('popup_error.message')
})
}
Vue.prototype.$checkFileMimetype = function (files) {
let validated = true
let mimetypesBlacklist = store.getters.config.mimetypesBlacklist