From 5c74962ac61b39b0fc0cb0765032e74dc3e5f1ce Mon Sep 17 00:00:00 2001 From: Noor Date: Wed, 14 May 2025 20:58:19 +0530 Subject: [PATCH] Enhance contract inspect Allow operators to access app and VM contracts to inspect --- src/grpc/app.rs | 5 +++-- src/grpc/vm.rs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/grpc/app.rs b/src/grpc/app.rs index 775c15a..1cf31ee 100644 --- a/src/grpc/app.rs +++ b/src/grpc/app.rs @@ -241,10 +241,11 @@ impl BrainAppCli for AppCliServer { if let Some(app_contract) = db::ActiveAppWithNode::get_by_uuid(&self.db, &req.uuid).await? { - if app_contract.admin.key().to_string() == req.admin_pubkey { + if app_contract.admin.key().to_string() == req.admin_pubkey + || app_contract.app_node.operator.key().to_string() == req.admin_pubkey + { app_contracts.push(app_contract); } - // TODO: allow operator to inspect contracts } } else if req.as_operator { app_contracts.append( diff --git a/src/grpc/vm.rs b/src/grpc/vm.rs index ebbd218..d7f6430 100644 --- a/src/grpc/vm.rs +++ b/src/grpc/vm.rs @@ -343,10 +343,11 @@ impl BrainVmCli for VmCliServer { if let Some(specific_contract) = db::ActiveVmWithNode::get_by_uuid(&self.db, &req.uuid).await? { - if specific_contract.admin.key().to_string() == req.wallet { + if specific_contract.admin.key().to_string() == req.wallet + || specific_contract.vm_node.operator.key().to_string() == req.wallet + { contracts.push(specific_contract); } - // TODO: allow operator to inspect contracts } } else if req.as_operator { contracts