48 lines
1.1 KiB
Vue
48 lines
1.1 KiB
Vue
<!--
|
|
|--------------------------------------------------------------------------
|
|
| Agência PSI
|
|
|--------------------------------------------------------------------------
|
|
| Criado e desenvolvido por Leonardo Nohama
|
|
|
|
|
| Tecnologia aplicada à escuta.
|
|
| Estrutura para o cuidado.
|
|
|
|
|
| Arquivo: src/components/security/FeatureGate.vue
|
|
| Data: 2026
|
|
| Local: São Carlos/SP — Brasil
|
|
|--------------------------------------------------------------------------
|
|
| © 2026 — Todos os direitos reservados
|
|
|--------------------------------------------------------------------------
|
|
-->
|
|
<script setup>
|
|
import { computed } from 'vue'
|
|
import { useEntitlementsStore } from '@/stores/entitlementsStore'
|
|
|
|
const props = defineProps({
|
|
feature: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
fallback: {
|
|
type: Boolean,
|
|
default: false
|
|
}
|
|
})
|
|
|
|
const ent = useEntitlementsStore()
|
|
|
|
const allowed = computed(() => {
|
|
return ent.can(props.feature)
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<template v-if="allowed">
|
|
<slot />
|
|
</template>
|
|
|
|
<template v-else-if="fallback">
|
|
<slot name="fallback" />
|
|
</template>
|
|
</template>
|