From 1afcd36deefe9a928281905e46c5dfffcd15f10d Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Mon, 1 Jun 2026 13:58:57 +0530 Subject: [PATCH] fix(contacts): align contact export permissions (#14601) Allows contact managers to export and import contacts from the Contacts page while keeping plain agents blocked. The contacts action menu now mirrors backend permissions for both export and import. ## Closes - https://linear.app/chatwoot/issue/CW-4438/contact-export-is-broken ## What changed - Allows Enterprise custom roles with `contact_manage` to pass `ContactPolicy#export?` and `ContactPolicy#import?`. - Shows Export and Import to admins and contact managers only. - Adds Enterprise policy coverage for contact export and import. ## Screenshots Admin: Export and Import are available. Admin contact actions with Export
and Import visible Contact manager: Export and Import are available. Contact manager contact actions
with Export and Import visible Regular agent: Export and Import are hidden. Regular agent contact actions with
Export and Import hidden ## How to test - Sign in as an administrator and open Contacts; the action menu shows Export and Import. - Sign in as a custom-role user with `contact_manage`; the action menu shows Export and Import. - Sign in as a plain agent; Export and Import are not available and both APIs remain unauthorized. --- .../components/ContactMoreActions.vue | 44 ++++++++++++------- app/policies/contact_policy.rb | 2 + .../app/policies/enterprise/contact_policy.rb | 9 ++++ .../policies/contact_policy_spec.rb | 26 +++++++++++ 4 files changed, 66 insertions(+), 15 deletions(-) create mode 100644 enterprise/app/policies/enterprise/contact_policy.rb create mode 100644 spec/enterprise/policies/contact_policy_spec.rb diff --git a/app/javascript/dashboard/components-next/Contacts/ContactsHeader/components/ContactMoreActions.vue b/app/javascript/dashboard/components-next/Contacts/ContactsHeader/components/ContactMoreActions.vue index d5932535c..9deaa84f2 100644 --- a/app/javascript/dashboard/components-next/Contacts/ContactsHeader/components/ContactMoreActions.vue +++ b/app/javascript/dashboard/components-next/Contacts/ContactsHeader/components/ContactMoreActions.vue @@ -1,34 +1,48 @@