From 49ac1557c1f901599edb63f3afa9d8e596761271 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Fri, 29 May 2026 16:18:54 +0530 Subject: [PATCH] feat: hide inbox channel provider credentials when using read only token --- app/views/api/v1/models/_inbox.json.jbuilder | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/api/v1/models/_inbox.json.jbuilder b/app/views/api/v1/models/_inbox.json.jbuilder index 5c6ce563d..105b4463b 100644 --- a/app/views/api/v1/models/_inbox.json.jbuilder +++ b/app/views/api/v1/models/_inbox.json.jbuilder @@ -69,7 +69,7 @@ json.phone_number resource.channel.try(:phone_number) json.medium resource.channel.try(:medium) if resource.twilio? if resource.twilio? json.content_templates resource.channel.try(:content_templates) - if Current.account_user&.administrator? + if Current.account_user&.administrator? && @access_token&.scope != 'read_only' json.auth_token resource.channel.try(:auth_token) json.account_sid resource.channel.try(:account_sid) json.api_key_sid resource.channel.try(:api_key_sid) @@ -85,7 +85,7 @@ if resource.email? ## IMAP if Current.account_user&.administrator? json.imap_login resource.channel.try(:imap_login) - json.imap_password resource.channel.try(:imap_password) + json.imap_password resource.channel.try(:imap_password) if @access_token&.scope != 'read_only' json.imap_address resource.channel.try(:imap_address) json.imap_port resource.channel.try(:imap_port) json.imap_enabled resource.channel.try(:imap_enabled) @@ -100,7 +100,7 @@ if resource.email? ## SMTP if Current.account_user&.administrator? json.smtp_login resource.channel.try(:smtp_login) - json.smtp_password resource.channel.try(:smtp_password) + json.smtp_password resource.channel.try(:smtp_password) if @access_token&.scope != 'read_only' json.smtp_address resource.channel.try(:smtp_address) json.smtp_port resource.channel.try(:smtp_port) json.smtp_enabled resource.channel.try(:smtp_enabled) @@ -129,7 +129,7 @@ json.bot_name resource.channel.try(:bot_name) if resource.telegram? ### WhatsApp Channel if resource.whatsapp? json.message_templates resource.channel.try(:message_templates) - json.provider_config resource.channel.try(:provider_config) if Current.account_user&.administrator? + json.provider_config resource.channel.try(:provider_config) if Current.account_user&.administrator? && @access_token&.scope != 'read_only' json.reauthorization_required resource.channel.try(:reauthorization_required?) end