fn set_grant( state: &AppState, account_id: &str, agent_id: &str, service: &str, level: &str, ) -> Result<Value, String>