Several updates to avoid acess to forbidden pages via URL #274.
This commit is contained in:
parent
64d462f880
commit
db269db8ca
|
@ -483,7 +483,7 @@
|
|||
<div class="content has-text-grey has-text-centered">
|
||||
<p>
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-30px tainacan-icon-collection"/>
|
||||
<i class="tainacan-icon tainacan-icon-30px tainacan-icon-items"/>
|
||||
</span>
|
||||
</p>
|
||||
<p>{{ $i18n.get('info_can_not_edit_collection') }}</p>
|
||||
|
@ -694,7 +694,10 @@ export default {
|
|||
this.isLoading = false;
|
||||
|
||||
})
|
||||
.catch(error => this.$console.error(error));
|
||||
.catch((error) => {
|
||||
this.$console.error(error);
|
||||
this.isLoading = false;
|
||||
});
|
||||
},
|
||||
clearErrors(attribute) {
|
||||
this.editFormErrors[attribute] = undefined;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<hr>
|
||||
</div>
|
||||
<form
|
||||
v-if="!isLoading"
|
||||
v-if="!isLoading && collection && collection.current_user_can_bulk_edit"
|
||||
class="tainacan-form"
|
||||
label-width="120px">
|
||||
|
||||
|
@ -170,6 +170,18 @@
|
|||
</div>
|
||||
</footer>
|
||||
</form>
|
||||
<template v-else-if="!isLoading && collection && !collection.current_user_can_bulk_edit">
|
||||
<section class="section">
|
||||
<div class="content has-text-grey has-text-centered">
|
||||
<p>
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-30px tainacan-icon-collection"/>
|
||||
</span>
|
||||
</p>
|
||||
<p>{{ $i18n.get('info_can_not_bulk_edit_items_collection') }}</p>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -194,6 +206,9 @@ export default {
|
|||
computed: {
|
||||
uploadedFileList() {
|
||||
return this.getFiles();
|
||||
},
|
||||
collection() {
|
||||
return this.getCollection()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -204,6 +219,7 @@ export default {
|
|||
]),
|
||||
...mapGetters('collection', [
|
||||
'getFiles',
|
||||
'getCollection'
|
||||
]),
|
||||
...mapActions('item', [
|
||||
'sendItem',
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
mode="out-in"
|
||||
:name="(isOnSequenceEdit && sequenceRightDirection != undefined) ? (sequenceRightDirection ? 'page-right' : 'page-left') : ''">
|
||||
<form
|
||||
v-if="!isLoading && ((isCreatingNewItem && collection.current_user_can_edit_items) || (!isCreatingNewItem && item && item.current_user_can_edit && item.status != 'publish'))"
|
||||
v-if="!isLoading && ((isCreatingNewItem && collection && collection.current_user_can_edit_items) || (!isCreatingNewItem && item && item.current_user_can_edit && item.status != 'publish'))"
|
||||
class="tainacan-form"
|
||||
label-width="120px">
|
||||
<div class="columns">
|
||||
|
@ -538,12 +538,12 @@
|
|||
</form>
|
||||
|
||||
<!-- In case user enters this page whithout having permission -->
|
||||
<template v-if="!isLoading && ((isCreatingNewItem && !collection.current_user_can_edit_items) || (!isCreatingNewItem && item && item.current_user_can_edit != undefined && collection.current_user_can_edit == false))">
|
||||
<template v-if="!isLoading && ((isCreatingNewItem && collection && collection.current_user_can_edit_items == false) || (!isCreatingNewItem && item && item.current_user_can_edit != undefined && collection && collection.current_user_can_edit_items == false))">
|
||||
<section class="section">
|
||||
<div class="content has-text-grey has-text-centered">
|
||||
<p>
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-30px tainacan-icon-item"/>
|
||||
<i class="tainacan-icon tainacan-icon-30px tainacan-icon-items"/>
|
||||
</span>
|
||||
</p>
|
||||
<p>{{ $i18n.get('info_can_not_edit_item') }}</p>
|
||||
|
@ -1006,7 +1006,10 @@ export default {
|
|||
.catch(() => this.isLoadingAttachments = false);
|
||||
|
||||
})
|
||||
.catch(error => this.$console.error(error));
|
||||
.catch((error) => {
|
||||
this.$console.error(error);
|
||||
this.isLoading = false;
|
||||
});
|
||||
},
|
||||
loadMetadata() {
|
||||
// Obtains Item Metadatum
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<hr>
|
||||
</div>
|
||||
<form
|
||||
v-if="collection && collection.current_user_can_bulk_edit"
|
||||
class="tainacan-form"
|
||||
label-width="120px">
|
||||
|
||||
|
@ -183,6 +184,18 @@
|
|||
</div>
|
||||
</footer>
|
||||
</form>
|
||||
<template v-if="collection && !collection.current_user_can_bulk_edit">
|
||||
<section class="section">
|
||||
<div class="content has-text-grey has-text-centered">
|
||||
<p>
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-30px tainacan-icon-collection"/>
|
||||
</span>
|
||||
</p>
|
||||
<p>{{ $i18n.get('info_can_not_bulk_edit_items_collection') }}</p>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -231,6 +244,9 @@ export default {
|
|||
},
|
||||
showLoading() {
|
||||
return this.isLoadingMetadata || this.isLoadingItemMetadata;
|
||||
},
|
||||
collection() {
|
||||
return this.getCollection()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -244,6 +260,9 @@ export default {
|
|||
...mapGetters('metadata', [
|
||||
'getMetadata',
|
||||
]),
|
||||
...mapGetters('collection', [
|
||||
'getCollection',
|
||||
]),
|
||||
...mapActions('bulkedition', [
|
||||
'setValueInBulk',
|
||||
'addValueInBulk',
|
||||
|
@ -432,7 +451,8 @@ export default {
|
|||
this.itemMetadata = metadata;
|
||||
this.isLoadingItemMetadata = false;
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => this.isLoadingItemMetadata = false);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -459,7 +479,8 @@ export default {
|
|||
this.metadatumCollapses[i] = true;
|
||||
}
|
||||
this.loadItemMetadata();
|
||||
});
|
||||
})
|
||||
.catch(() => this.isLoadingMetadata = false);
|
||||
|
||||
this.isLoadingGroupInfo = true;
|
||||
this.fetchGroup({ collectionId: this.collectionId, groupId: this.groupID })
|
||||
|
|
|
@ -265,20 +265,22 @@
|
|||
beforeRouteLeave( to, from, next ) {
|
||||
let formNotSaved = false;
|
||||
|
||||
if (this.taxonomy.name != this.form.name)
|
||||
formNotSaved = true;
|
||||
if (this.taxonomy.description != this.form.description)
|
||||
formNotSaved = true;
|
||||
if (this.taxonomy.slug != this.form.slug)
|
||||
formNotSaved = true;
|
||||
if (this.taxonomy.allow_insert != this.form.allowInsert)
|
||||
formNotSaved = true;
|
||||
if (this.taxonomy.status != this.form.status)
|
||||
formNotSaved = true;
|
||||
if (this.taxonomy.enabled_post_types != this.form.enabledPostTypes)
|
||||
formNotSaved = true;
|
||||
if (this.taxonomy) {
|
||||
if (this.taxonomy.name != this.form.name)
|
||||
formNotSaved = true;
|
||||
if (this.taxonomy.description != this.form.description)
|
||||
formNotSaved = true;
|
||||
if (this.taxonomy.slug != this.form.slug)
|
||||
formNotSaved = true;
|
||||
if (this.taxonomy.allow_insert != this.form.allowInsert)
|
||||
formNotSaved = true;
|
||||
if (this.taxonomy.status != this.form.status)
|
||||
formNotSaved = true;
|
||||
if (this.taxonomy.enabled_post_types != this.form.enabledPostTypes)
|
||||
formNotSaved = true;
|
||||
}
|
||||
|
||||
if (formNotSaved) {
|
||||
if (formNotSaved && this.taxonomy) {
|
||||
this.$buefy.modal.open({
|
||||
parent: this,
|
||||
component: CustomDialog,
|
||||
|
@ -434,7 +436,10 @@
|
|||
this.shouldReloadTermsList = false;
|
||||
|
||||
})
|
||||
.catch(error => this.$console.error(error));
|
||||
.catch((error) => {
|
||||
this.$console.error(error)
|
||||
this.isLoadingTaxonomy = false;
|
||||
});
|
||||
},
|
||||
clearErrors(attribute) {
|
||||
this.editFormErrors[attribute] = undefined;
|
||||
|
@ -507,7 +512,8 @@
|
|||
this.form.enabledPostTypes = this.taxonomy.enabled_post_types;
|
||||
|
||||
this.isLoadingTaxonomy = false;
|
||||
});
|
||||
})
|
||||
.catch(() => this.isLoadingTaxonomy = false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
<div
|
||||
v-if="collections.length > 0 && !isLoading"
|
||||
class="table-container">
|
||||
<div class="selection-control">
|
||||
<div
|
||||
v-if="$userCaps.hasCapability('tnc_rep_delete_collections')"
|
||||
class="selection-control">
|
||||
<div class="field select-all is-pulled-left">
|
||||
<span>
|
||||
<b-checkbox
|
||||
|
@ -13,7 +15,6 @@
|
|||
<div class="field is-pulled-right">
|
||||
<b-dropdown
|
||||
position="is-bottom-left"
|
||||
v-if="$userCaps.hasCapability('tnc_rep_delete_collections')"
|
||||
:disabled="!isSelectingCollections"
|
||||
id="bulk-actions-dropdown"
|
||||
aria-role="list"
|
||||
|
@ -88,7 +89,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<!-- Checking list -->
|
||||
<th>
|
||||
<th v-if="$userCaps.hasCapability('tnc_rep_delete_collections')">
|
||||
|
||||
<!-- nothing to show on header -->
|
||||
</th>
|
||||
|
@ -116,7 +117,9 @@
|
|||
<th v-if="!isOnTrash">
|
||||
<div class="th-wrap total-items-header">{{ $i18n.get('label_total_items') }}</div>
|
||||
</th>
|
||||
<th class="actions-header">
|
||||
<th
|
||||
v-if="collections.findIndex((collection) => collection.current_user_can_edit || collection.current_user_can_delete).length >= 0"
|
||||
class="actions-header">
|
||||
|
||||
<!-- nothing to show on header for actions cell-->
|
||||
</th>
|
||||
|
@ -129,6 +132,7 @@
|
|||
v-for="(collection, index) of collections">
|
||||
<!-- Checking list -->
|
||||
<td
|
||||
v-if="$userCaps.hasCapability('tnc_rep_delete_collections')"
|
||||
:class="{ 'is-selecting': isSelectingCollections }"
|
||||
class="checkbox-cell">
|
||||
<b-checkbox
|
||||
|
@ -252,8 +256,10 @@
|
|||
</td>
|
||||
<!-- Actions -->
|
||||
<td
|
||||
v-if="collection.current_user_can_edit || collection.current_user_can_delete"
|
||||
@click="onClickCollection($event, collection.id, index)"
|
||||
class="actions-cell column-default-width"
|
||||
class="column-default-width"
|
||||
:class="{ 'actions-cell': collection.current_user_can_edit || collection.current_user_can_delete }"
|
||||
:label="$i18n.get('label_actions')">
|
||||
<div class="actions-container">
|
||||
<a
|
||||
|
|
|
@ -65,7 +65,9 @@
|
|||
<div class="th-wrap">{{ $i18n.get('label_collections_using') }}</div>
|
||||
</th>
|
||||
<!-- Actions -->
|
||||
<th class="actions-header">
|
||||
<th
|
||||
v-if="taxonomies.findIndex((taxonomy) => taxonomy.current_user_can_edit || taxonomy.current_user_can_delete).length >= 0"
|
||||
class="actions-header">
|
||||
|
||||
<!-- nothing to show on header for actions cell-->
|
||||
</th>
|
||||
|
@ -142,6 +144,7 @@
|
|||
</td>
|
||||
<!-- Actions -->
|
||||
<td
|
||||
v-if="taxonomy.current_user_can_edit || taxonomy.current_user_can_delete"
|
||||
@click="onClickTaxonomy($event, taxonomy.id, index)"
|
||||
class="column-default-width"
|
||||
:class="{ 'actions-cell': taxonomy.current_user_can_edit || taxonomy.current_user_can_delete }"
|
||||
|
|
|
@ -153,7 +153,7 @@
|
|||
</p>
|
||||
<p>{{ searchQuery != '' ? $i18n.get('info_no_terms_found') : $i18n.get('info_no_terms_created_on_taxonomy') }}</p>
|
||||
<button
|
||||
v-if="searchQuery == ''"
|
||||
v-if="searchQuery == '' && currentUserCanEditTaxonomy"
|
||||
id="button-create-term"
|
||||
class="button is-secondary"
|
||||
@click="addNewTerm(0)">
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<div class="content has-text-grey has-text-centered">
|
||||
<p>
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-30px tainacan-icon-capability"/>
|
||||
<i class="tainacan-icon tainacan-icon-30px tainacan-icon-user"/>
|
||||
</span>
|
||||
</p>
|
||||
<p>{{ $i18n.get('info_can_not_edit_capabilities') }}</p>
|
||||
|
@ -49,7 +49,7 @@
|
|||
</template>
|
||||
|
||||
<!-- Empty state -->
|
||||
<div v-if="capabilities.length <= 0 && !isLoading">
|
||||
<div v-if="capabilities.length <= 0 && !isLoading && $userCaps.hasCapability('tnc_rep_edit_users')">
|
||||
<section class="section">
|
||||
<div class="content has-text-grey has-text-centered">
|
||||
<p>
|
||||
|
|
|
@ -693,6 +693,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'info_can_not_edit_capabilities' => __( 'You are not allowed to edit capabilities.', 'tainacan' ),
|
||||
'info_can_not_read_activities' => __( 'You are not allowed to read activities.', 'tainacan' ),
|
||||
'info_can_not_edit_item' => __( 'You are not allowed to edit this item.', 'tainacan' ),
|
||||
'info_can_not_bulk_edit_items_collection' => __( 'You are not allowed to bulk edit items from this collection.', 'tainacan' ),
|
||||
|
||||
// Datepicker months
|
||||
'datepicker_month_january' => __( 'January', 'tainacan' ),
|
||||
|
|
Loading…
Reference in New Issue