From b6d71faf5f4eb72413cfbcee53c34ca81a4faa33 Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 9 Jul 2025 22:08:08 -0400 Subject: [PATCH] feat: Improve role verification logic in InterestDuplicateNotificationBanner for duplicate checks --- components/InterestDuplicateNotificationBanner.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/InterestDuplicateNotificationBanner.vue b/components/InterestDuplicateNotificationBanner.vue index b9e33d5..2caef43 100644 --- a/components/InterestDuplicateNotificationBanner.vue +++ b/components/InterestDuplicateNotificationBanner.vue @@ -50,15 +50,16 @@ const checkForDuplicates = async () => { try { loading.value = true; - // Check roles with better error handling + // Check roles with better error handling - use hasAnyRole for multiple roles + const { hasAnyRole, isAdmin, isSalesOrAdmin } = useAuthorization(); let canViewDuplicates = false; + try { - canViewDuplicates = await hasRole(['sales', 'admin']); + canViewDuplicates = isSalesOrAdmin(); // Use the convenience method console.log('[InterestDuplicateNotification] Role check result:', canViewDuplicates); } catch (roleError) { console.error('[InterestDuplicateNotification] Role check failed:', roleError); // Try to get user info directly as fallback - const { isAdmin } = useAuthorization(); canViewDuplicates = isAdmin(); console.log('[InterestDuplicateNotification] Fallback admin check:', canViewDuplicates); }