From ccb3a559add27212b32f094e10ba38bc438d0c07 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 29 May 2023 17:35:24 +0200 Subject: [PATCH] removed requirement for subuser logic to be admin (#94) --- web3_proxy/src/frontend/users/subuser.rs | 36 +----------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/web3_proxy/src/frontend/users/subuser.rs b/web3_proxy/src/frontend/users/subuser.rs index e382da73..ee4b40c6 100644 --- a/web3_proxy/src/frontend/users/subuser.rs +++ b/web3_proxy/src/frontend/users/subuser.rs @@ -106,23 +106,6 @@ pub async fn get_subusers( .db_replica() .context("getting replica db for user's revert logs")?; - // Second, check if the user is a premium user - let user_tier = user_tier::Entity::find() - .filter(user_tier::Column::Id.eq(user.user_tier_id)) - .one(db_replica.conn()) - .await? - .ok_or(Web3ProxyError::BadRequest( - "Could not find user in db although bearer token is there!".to_string(), - ))?; - - debug!("User tier is: {:?}", user_tier); - // TODO: This shouldn't be hardcoded. Also, it should be an enum, not sth like this ... - if user_tier.id != 6 { - return Err( - anyhow::anyhow!("User is not premium. Must be premium to create referrals.").into(), - ); - } - let rpc_key: Ulid = params .remove("rpc_key") // TODO: map_err so this becomes a 500. routing must be bad @@ -197,24 +180,7 @@ pub async fn modify_subuser( .db_replica() .context("getting replica db for user's revert logs")?; - // Second, check if the user is a premium user - let user_tier = user_tier::Entity::find() - .filter(user_tier::Column::Id.eq(user.user_tier_id)) - .one(db_replica.conn()) - .await? - .ok_or(Web3ProxyError::BadRequest( - "Could not find user in db although bearer token is there!".to_string(), - ))?; - - debug!("User tier is: {:?}", user_tier); - // TODO: This shouldn't be hardcoded. Also, it should be an enum, not sth like this ... - if user_tier.id != 6 { - return Err( - anyhow::anyhow!("User is not premium. Must be premium to create referrals.").into(), - ); - } - - warn!("Parameters are: {:?}", params); + debug!("Parameters are: {:?}", params); // Then, distinguish the endpoint to modify let rpc_key_to_modify: Ulid = params