Enhance contract inspect

Allow operators to access app and VM contracts to inspect
This commit is contained in:
Noor 2025-05-14 20:58:19 +05:30
parent 8caa55e325
commit 5c74962ac6
Signed by: noormohammedb
GPG Key ID: D83EFB8B3B967146
2 changed files with 6 additions and 4 deletions

@ -241,10 +241,11 @@ impl BrainAppCli for AppCliServer {
if let Some(app_contract) = if let Some(app_contract) =
db::ActiveAppWithNode::get_by_uuid(&self.db, &req.uuid).await? 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); app_contracts.push(app_contract);
} }
// TODO: allow operator to inspect contracts
} }
} else if req.as_operator { } else if req.as_operator {
app_contracts.append( app_contracts.append(

@ -343,10 +343,11 @@ impl BrainVmCli for VmCliServer {
if let Some(specific_contract) = if let Some(specific_contract) =
db::ActiveVmWithNode::get_by_uuid(&self.db, &req.uuid).await? 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); contracts.push(specific_contract);
} }
// TODO: allow operator to inspect contracts
} }
} else if req.as_operator { } else if req.as_operator {
contracts contracts