diff --git a/desci-repo/src/repo.ts b/desci-repo/src/repo.ts index 968c13e50..fe90c1c23 100644 --- a/desci-repo/src/repo.ts +++ b/desci-repo/src/repo.ts @@ -29,18 +29,15 @@ const config: RepoConfig = { sharePolicy: async (peerId, documentId) => { try { if (!documentId) { - logger.trace({ peerId }, 'SharePolicy: Document ID NOT found'); return false; } // peer format: `peer-[user#id]:[unique string combination] if (peerId.toString().length < 8) { - logger.error({ peerId }, 'SharePolicy: Peer ID invalid'); return false; } const userId = peerId.split(':')?.[0]?.split('-')?.[1]; const isAuthorised = await verifyNodeDocumentAccess(Number(userId), documentId); - logger.trace({ peerId, userId, documentId, isAuthorised }, '[SHARE POLICY CALLED]::'); return isAuthorised; } catch (err) { logger.error({ err }, 'Error in share policy'); diff --git a/desci-repo/src/services/nodes.ts b/desci-repo/src/services/nodes.ts index d7d60236b..6da88e2e9 100644 --- a/desci-repo/src/services/nodes.ts +++ b/desci-repo/src/services/nodes.ts @@ -4,22 +4,17 @@ import { logger } from '../logger.js'; export const verifyNodeDocumentAccess = async (userId: number, documentId: DocumentId) => { try { - logger.trace({ userId, documentId }, 'START [verifyNodeDocumentAccess]::Node'); const rows = await query('SELECT * FROM "Node" WHERE "manifestDocumentId" = $1 AND "ownerId" = $2', [ documentId, userId, ]); const node = rows?.[0]; - logger.trace( - { uuid: node.uuid, userId, ownerId: node.ownerId, documentId: node.manifestDocumentId }, - '[verifyNodeDocumentAccess]::Node', - ); - if (!node) return false; if (node.manifestDocumentId === documentId && node.ownerId === userId) return true; return false; - } catch (e) { + } catch (error) { + logger.error({ error }, 'VerifyNodeDocumentAccess'); return false; } };