fixed unallowed cards access for free users

This commit is contained in:
Bachir Soussi Chiadmi 2021-09-03 10:39:00 +02:00
parent 19cb887ee6
commit 9b49e1bf20
11 changed files with 19 additions and 14 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,11 +3,11 @@
<header
@click.prevent="openModalCard"
>
<h1 v-if="isloggedin">{{ item.title }}</h1>
<h1 v-if="hasDBAccess">{{ item.title }}</h1>
<h4>{{ item.short_description }}</h4>
<span v-if="isloggedin" class="ref">{{ item.reference }}</span>
<span v-if="hasDBAccess" class="ref">{{ item.reference }}</span>
</header>
<nav class="tools" v-if="isloggedin">
<nav class="tools" v-if="hasDBAccess">
<section class="tool flags">
<span class="btn mdi mdi-folder-outline"/>
<div class="tool-content">
@ -117,7 +117,8 @@ export default {
computed: {
...mapState({
flagcolls: state => state.User.flagcolls,
isloggedin: state => state.User.isloggedin
isloggedin: state => state.User.isloggedin,
hasDBAccess: state => state.User.hasDBAccess
}),
collsLength() {
return Object.keys(this.flagcolls).length
@ -192,8 +193,8 @@ export default {
// this.lightbox_index = index
// },
openModalCard (e) {
console.log('openModalCard', this.isLoggedin)
if (this.isloggedin) {
console.log('openModalCard', this.hasDBAccess)
if (this.hasDBAccess) {
this.$modal.show(
ModalCard,
{

View File

@ -5,7 +5,7 @@ import qs from 'querystring-es3'
import materiauGQL from 'vuejs/api/gql/materiauflaglist.fragment.gql'
import router from 'vuejs/route' // this is not working
// import router from 'vuejs/route' // this is not working
export default {
namespaced: true,
@ -24,6 +24,7 @@ export default {
isAdmin: false,
isAdherent: false,
canSearch: false,
hasDBAccess: false,
roles: [],
flagcolls: false,
flagcollsLoadedItems: {},
@ -85,6 +86,9 @@ export default {
state.canSearch = true
state.isAdherent = true
}
if (state.isAdherent || state.isAdmin) {
state.hasDBAccess = true
}
},
setLoggedOut (state) {
console.log('setLoggedOut state', state)