From 1408b5d05e6ae4258754b219188d69bf670923a6 Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Tue, 14 Nov 2017 18:44:58 +0100
Subject: [PATCH] [enh] Sandbox: also missing the `from` case

---
 app/lib/dal/sqliteDAL/DocumentDAL.ts | 7 ++++---
 app/lib/dal/sqliteDAL/SandBox.ts     | 2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/app/lib/dal/sqliteDAL/DocumentDAL.ts b/app/lib/dal/sqliteDAL/DocumentDAL.ts
index a60aa335e..fe8fc2e0b 100644
--- a/app/lib/dal/sqliteDAL/DocumentDAL.ts
+++ b/app/lib/dal/sqliteDAL/DocumentDAL.ts
@@ -1,5 +1,6 @@
 export interface DBDocument {
-  pubkey?: string
-  issuer?: string
-  issuers?: string[]
+  pubkey?: string     // idty table
+  from?: string       // cert table
+  issuer?: string     // membership table
+  issuers?: string[]  // txs table
 }
\ No newline at end of file
diff --git a/app/lib/dal/sqliteDAL/SandBox.ts b/app/lib/dal/sqliteDAL/SandBox.ts
index 85ae101c5..fe96af44e 100644
--- a/app/lib/dal/sqliteDAL/SandBox.ts
+++ b/app/lib/dal/sqliteDAL/SandBox.ts
@@ -13,7 +13,9 @@ export class SandBox<T extends DBDocument> {
   }
   
   async acceptNewSandBoxEntry(element:T, pubkey:string) {
+    // Accept any document which has the exception pubkey (= the node pubkey)
     if (element.pubkey === pubkey
+      || element.from === pubkey
       || element.issuer === pubkey
       || (element.issuers !== undefined && element.issuers.indexOf(pubkey) !== -1)) {
       return true;
-- 
GitLab