feat: implement user ban check by node operator in app deployement
This commit is contained in:
parent
beb56f5a9c
commit
9eeb9390fd
@ -1006,6 +1006,15 @@ impl BrainData {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(node) = self.find_app_node_by_pubkey(&node_pubkey) {
|
||||
if let Some(account) = self.accounts.get(user_wallet) {
|
||||
if account.banned_by.contains(&node.operator_wallet) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
|
@ -507,6 +507,14 @@ impl BrainAppCli for BrainAppCliMock {
|
||||
) -> Result<tonic::Response<NewAppRes>, Status> {
|
||||
let req_data = check_sig_from_req(req)?;
|
||||
log::info!("Creating new container: {req_data:?}");
|
||||
if self
|
||||
.data
|
||||
.is_user_banned_by_node(&req_data.admin_pubkey, &req_data.node_pubkey)
|
||||
{
|
||||
return Err(Status::permission_denied(
|
||||
"This operator banned you. What did you do?",
|
||||
));
|
||||
}
|
||||
let admin_pubkey = req_data.admin_pubkey.clone();
|
||||
let (oneshot_tx, oneshot_rx) = tokio::sync::oneshot::channel();
|
||||
self.data.send_new_container_req(req_data, oneshot_tx).await;
|
||||
|
Loading…
Reference in New Issue
Block a user