diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/credentials/credentials-manager.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/credentials/credentials-manager.tsx
index 771718850..b25f14c6e 100644
--- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/credentials/credentials-manager.tsx
+++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/credentials/credentials-manager.tsx
@@ -722,6 +722,32 @@ export function CredentialsManager() {
}
const [isPromoting, setIsPromoting] = useState(false)
+ const [isShareingWithWorkspace, setIsSharingWithWorkspace] = useState(false)
+
+ const handleShareWithWorkspace = async () => {
+ if (!selectedCredential || !isSelectedAdmin) return
+ const usersToAdd = workspaceUserOptions
+ if (usersToAdd.length === 0) return
+
+ setDetailsError(null)
+ setIsSharingWithWorkspace(true)
+
+ try {
+ for (const user of usersToAdd) {
+ await upsertMember.mutateAsync({
+ credentialId: selectedCredential.id,
+ userId: user.value,
+ role: 'member',
+ })
+ }
+ } catch (error: unknown) {
+ const message = error instanceof Error ? error.message : 'Failed to share with workspace'
+ setDetailsError(message)
+ logger.error('Failed to share credential with workspace', error)
+ } finally {
+ setIsSharingWithWorkspace(false)
+ }
+ }
const handlePromoteToWorkspace = async () => {
if (!selectedCredential || selectedCredential.type !== 'env_personal' || !workspaceId) return
@@ -929,15 +955,6 @@ export function CredentialsManager() {
{isSelectedAdmin && (
- {selectedCredential.type === 'oauth' && (
-
- )}
{selectedCredential.type === 'env_personal' && (
@@ -952,6 +969,36 @@ export function CredentialsManager() {
Promote to workspace secret
)}
+ {selectedCredential.type !== 'env_workspace' &&
+ (workspaceUserOptions.length > 0 || isShareingWithWorkspace) && (
+
+
+
+
+
+ {isShareingWithWorkspace
+ ? 'Sharing...'
+ : `Add all ${workspaceUserOptions.length} remaining workspace member${workspaceUserOptions.length === 1 ? '' : 's'}`}
+
+
+ )}
+ {selectedCredential.type === 'oauth' && (
+
+ )}
{selectedCredential.type !== 'oauth' && (