opertypes: enforced oper privilege system (users/auspex, channels/auspex)

Add has_priv/user_has_priv and wire the auspex privileges into their gates:
WHOIS real host+IP + geo, WHO secret-channel members + hidden +i users,
LIST secret/private channels, and the connect-notice IP/geo redaction.
Only netadmin holds every privilege by default; the reusable auspex class
grants the pair to any other oper type. Replaces the ad-hoc snoop type gate.
This commit is contained in:
Jean Chevronnet 2026-08-29 01:24:42 +00:00
parent d73f68f278
commit ff380d601d
No known key found for this signature in database
GPG key ID: 439666D63A9477E4
5 changed files with 79 additions and 43 deletions

View file

@ -99,11 +99,12 @@ impl Command for List {
}
fn handle(&self, s: &mut Server, uid: Uid, _params: &[String]) -> CmdResult {
s.numeric(uid, RPL_LISTSTART, "Channel :Users Name");
let auspex = crate::modules::opertypes::has_priv(s, uid, "channels/auspex");
let keys: Vec<String> = s.channels.keys().cloned().collect();
for key in keys {
let ch = &s.channels[&key];
// hide secret / private channels from non-members
if (ch.modes.secret || ch.modes.private) && !ch.members.contains_key(&uid) {
// hide secret / private channels from non-members (channels/auspex sees them)
if (ch.modes.secret || ch.modes.private) && !ch.members.contains_key(&uid) && !auspex {
continue;
}
let count = ch.members.len() + ch.rmembers.len();