-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This will be used by irctest to wait for sable_history to be up and reachable
- Loading branch information
Showing
6 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use super::*; | ||
use sable_network::prelude::wrapper::ObjectWrapper; | ||
|
||
#[command_handler("LINKS")] | ||
fn handle_links( | ||
response: &dyn CommandResponse, | ||
server: &ClientServer, | ||
net: &Network, | ||
source: UserSource, | ||
) -> CommandResult { | ||
server.policy().can_list_links(&source)?; | ||
|
||
for server in net.servers() { | ||
let server_info = format!( | ||
"last_ping={}, version={}", | ||
server.last_ping(), | ||
server.raw().version | ||
); | ||
response.numeric(make_numeric!(Links, server.name(), 0, &server_info)); | ||
} | ||
|
||
response.numeric(make_numeric!(EndOfLinks)); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ mod handlers { | |
mod kick; | ||
mod kill; | ||
mod kline; | ||
mod links; | ||
mod mode; | ||
mod monitor; | ||
mod motd; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#![allow(clippy::crate_in_macro_def)] | ||
|
||
use super::*; | ||
|
||
/// Makes authorisation decisions regarding inspecting private but non-sensitive | ||
/// network information | ||
#[delegatable_trait] | ||
pub trait DebuggingPolicyService { | ||
/// Determine whether a given user is permitted to oper up | ||
fn can_list_links(&self, user: &wrapper::User) -> PermissionResult; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use super::*; | ||
|
||
/// Standard implementation of [`DebuggingPolicyService`] | ||
pub struct StandardDebuggingPolicy {} | ||
|
||
impl StandardDebuggingPolicy { | ||
pub fn new() -> Self { | ||
Self {} | ||
} | ||
} | ||
|
||
impl DebuggingPolicyService for StandardDebuggingPolicy { | ||
fn can_list_links(&self, _user: &wrapper::User) -> PermissionResult { | ||
Ok(()) | ||
} | ||
} |