mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 19:17:48 +00:00 
			
		
		
		
	 cc4851b19d
			
		
	
	cc4851b19d
	
	
	
		
			
			We previously relied on user roles to determine whether to render specific routes in our frontend components. A permissions-based model is replacing this approach. Follow up: #9695 Co-authored-by: Pranav <pranavrajs@gmail.com>
		
			
				
	
	
		
			24 lines
		
	
	
		
			521 B
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			521 B
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <script setup>
 | |
| import { useStoreGetters } from 'dashboard/composables/store';
 | |
| import { computed } from 'vue';
 | |
| import { hasPermissions } from '../helper/permissionsHelper';
 | |
| const props = defineProps({
 | |
|   permissions: {
 | |
|     type: Array,
 | |
|     required: true,
 | |
|   },
 | |
| });
 | |
| 
 | |
| const getters = useStoreGetters();
 | |
| const user = getters.getCurrentUser.value;
 | |
| const hasPermission = computed(() =>
 | |
|   hasPermissions(props.permissions, user.permissions)
 | |
| );
 | |
| </script>
 | |
| 
 | |
| <template>
 | |
|   <div v-if="hasPermission">
 | |
|     <slot />
 | |
|   </div>
 | |
| </template>
 |