Bugfix/shared credentials not showing on ui (#5383)

* fix shared credentials not showing on ui

* Enhance credential retrieval by including createdDate, updatedDate, and workspaceId fields; sanitize shared item data by omitting encryptedData.
This commit is contained in:
Henry Heng
2025-10-29 10:06:23 +00:00
committed by GitHub
parent eed7581d0e
commit e925801b63
3 changed files with 20 additions and 35 deletions
@@ -264,7 +264,7 @@ export class WorkspaceService {
const itemIds = sharedItems.map((item) => item.sharedItemId)
if (itemType === 'credential') {
return await this.dataSource.getRepository(Credential).find({
select: ['id', 'name', 'credentialName'],
select: ['id', 'name', 'credentialName', 'createdDate', 'updatedDate', 'workspaceId'],
where: { id: In(itemIds) }
})
} else if (itemType === 'custom_template') {
@@ -50,7 +50,7 @@ const deleteCredentials = async (credentialId: string): Promise<any> => {
const getAllCredentials = async (paramCredentialName: any, workspaceId?: string) => {
try {
const appServer = getRunningExpressApp()
let dbResponse = []
let dbResponse: any[] = []
if (paramCredentialName) {
if (Array.isArray(paramCredentialName)) {
for (let i = 0; i < paramCredentialName.length; i += 1) {
@@ -83,14 +83,14 @@ const getAllCredentials = async (paramCredentialName: any, workspaceId?: string)
if (sharedItem.credentialName === name) {
// @ts-ignore
sharedItem.shared = true
dbResponse.push(sharedItem)
dbResponse.push(omit(sharedItem, ['encryptedData']))
}
}
} else {
if (sharedItem.credentialName === paramCredentialName) {
// @ts-ignore
sharedItem.shared = true
dbResponse.push(sharedItem)
dbResponse.push(omit(sharedItem, ['encryptedData']))
}
}
}
@@ -110,7 +110,7 @@ const getAllCredentials = async (paramCredentialName: any, workspaceId?: string)
for (const sharedItem of sharedItems) {
// @ts-ignore
sharedItem.shared = true
dbResponse.push(sharedItem)
dbResponse.push(omit(sharedItem, ['encryptedData']))
}
}
}