chanserv: give SOP/AOP/HOP/VOP four distinct access tiers matching Anope, classified by capability
All checks were successful
CI / check (push) Successful in 3m55s
All checks were successful
CI / check (push) Successful in 3m55s
This commit is contained in:
parent
f5c976eb56
commit
c8106035df
6 changed files with 119 additions and 41 deletions
|
|
@ -648,7 +648,11 @@ pub struct Caps {
|
||||||
pub fn level_caps(level: &str) -> Caps {
|
pub fn level_caps(level: &str) -> Caps {
|
||||||
match level {
|
match level {
|
||||||
"founder" => Caps { auto: Some("+o"), op: true, topic: true, invite: true, access: true, set: true, greet: true, rank: 3 },
|
"founder" => Caps { auto: Some("+o"), op: true, topic: true, invite: true, access: true, set: true, greet: true, rank: 3 },
|
||||||
|
// SOP = op plus access-list management; AOP = op; HOP = halfop; VOP = voice.
|
||||||
|
// These are the tiers the XOP shortcuts store; ordered high to low.
|
||||||
|
"sop" => Caps { auto: Some("+o"), op: true, topic: true, invite: true, access: true, rank: 2, ..Caps::default() },
|
||||||
"op" => Caps { auto: Some("+o"), op: true, topic: true, invite: true, rank: 2, ..Caps::default() },
|
"op" => Caps { auto: Some("+o"), op: true, topic: true, invite: true, rank: 2, ..Caps::default() },
|
||||||
|
"halfop" => Caps { auto: Some("+h"), rank: 1, ..Caps::default() },
|
||||||
"voice" => Caps { auto: Some("+v"), rank: 1, ..Caps::default() },
|
"voice" => Caps { auto: Some("+v"), rank: 1, ..Caps::default() },
|
||||||
flags => {
|
flags => {
|
||||||
let has = |c: char| flags.contains(c);
|
let has = |c: char| flags.contains(c);
|
||||||
|
|
@ -685,6 +689,66 @@ pub fn level_caps(level: &str) -> Caps {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The tiered "XOP" role a stored access level resolves to. The four shortcut
|
||||||
|
/// tiers rank VOP < HOP < AOP < SOP (SOP is AOP plus access-list management);
|
||||||
|
/// the channel owner is `Founder`, and a granular FLAGS entry that lines up with
|
||||||
|
/// no tier is `Custom`. Classifying by resolved capability rather than the raw
|
||||||
|
/// level string means XOP- and FLAGS-set entries agree on which tier they are.
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub enum AccessRole {
|
||||||
|
Founder,
|
||||||
|
Sop,
|
||||||
|
Aop,
|
||||||
|
Hop,
|
||||||
|
Vop,
|
||||||
|
Custom,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AccessRole {
|
||||||
|
/// How the role reads in ALIST / STATUS output.
|
||||||
|
pub fn label(self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
Self::Founder => "founder",
|
||||||
|
Self::Sop => "sop",
|
||||||
|
Self::Aop => "op",
|
||||||
|
Self::Hop => "halfop",
|
||||||
|
Self::Vop => "voice",
|
||||||
|
Self::Custom => "access",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The XOP command word this role is the exact tier of, if any. Founder and
|
||||||
|
/// Custom entries belong to no XOP list.
|
||||||
|
pub fn xop_word(self) -> Option<&'static str> {
|
||||||
|
Some(match self {
|
||||||
|
Self::Sop => "SOP",
|
||||||
|
Self::Aop => "AOP",
|
||||||
|
Self::Hop => "HOP",
|
||||||
|
Self::Vop => "VOP",
|
||||||
|
_ => return None,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Classify a stored access `level` into its tiered role by resolved capability,
|
||||||
|
/// so a FLAGS entry lands in the same tier a XOP ADD would have given it.
|
||||||
|
pub fn access_role(level: &str) -> AccessRole {
|
||||||
|
let c = level_caps(level);
|
||||||
|
if c.set && c.access && c.op {
|
||||||
|
AccessRole::Founder
|
||||||
|
} else if c.op && c.access {
|
||||||
|
AccessRole::Sop
|
||||||
|
} else if c.op {
|
||||||
|
AccessRole::Aop
|
||||||
|
} else if c.auto == Some("+h") {
|
||||||
|
AccessRole::Hop
|
||||||
|
} else if c.auto == Some("+v") {
|
||||||
|
AccessRole::Vop
|
||||||
|
} else {
|
||||||
|
AccessRole::Custom
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The granular group-membership flags (GroupServ), same primitive, different
|
// The granular group-membership flags (GroupServ), same primitive, different
|
||||||
// letters: F founder, f modify the member/flags list, i invite members, s set
|
// letters: F founder, f modify the member/flags list, i invite members, s set
|
||||||
// group options, c the group may be granted channel access, m group memos.
|
// group options, c the group may be granted channel access, m group memos.
|
||||||
|
|
@ -1595,6 +1659,30 @@ mod tests {
|
||||||
let t = level_caps("t"); // topic-only: can topic, not op
|
let t = level_caps("t"); // topic-only: can topic, not op
|
||||||
assert!(t.topic && !t.op && t.auto.is_none());
|
assert!(t.topic && !t.op && t.auto.is_none());
|
||||||
assert!(level_caps("a").access && level_caps("f").set);
|
assert!(level_caps("a").access && level_caps("f").set);
|
||||||
|
|
||||||
|
// The four XOP tiers are distinct: SOP is AOP plus access-list rights,
|
||||||
|
// HOP is its own halfop tier.
|
||||||
|
assert!(level_caps("sop").op && level_caps("sop").access);
|
||||||
|
assert!(level_caps("op").op && !level_caps("op").access);
|
||||||
|
assert_eq!(level_caps("halfop").auto, Some("+h"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn access_role_classifies_each_tier_by_capability() {
|
||||||
|
// Presets round-trip to their own tier...
|
||||||
|
assert_eq!(access_role("sop"), AccessRole::Sop);
|
||||||
|
assert_eq!(access_role("op"), AccessRole::Aop);
|
||||||
|
assert_eq!(access_role("halfop"), AccessRole::Hop);
|
||||||
|
assert_eq!(access_role("voice"), AccessRole::Vop);
|
||||||
|
assert_eq!(access_role("founder"), AccessRole::Founder);
|
||||||
|
// ...and a granular FLAGS entry lands in the matching tier, so it lists
|
||||||
|
// under the same XOP shortcut a tier ADD would have used.
|
||||||
|
assert_eq!(access_role("otia"), AccessRole::Sop, "op + access = SOP");
|
||||||
|
assert_eq!(access_role("oti"), AccessRole::Aop, "op without access = AOP");
|
||||||
|
assert_eq!(access_role("v"), AccessRole::Vop);
|
||||||
|
assert_eq!(access_role("ti"), AccessRole::Custom, "no status mode = no XOP tier");
|
||||||
|
assert_eq!(access_role("sop").xop_word(), Some("SOP"));
|
||||||
|
assert_eq!(access_role("founder").xop_word(), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
use echo_api::Store;
|
use echo_api::Store;
|
||||||
use echo_api::{Sender, ServiceCtx};
|
use echo_api::{Sender, ServiceCtx};
|
||||||
|
|
||||||
// ACCESS <#channel> LIST | ADD <account> <op|voice> | DEL <account>
|
// The named tiers ACCESS ADD accepts, high to low; the granular FLAGS command
|
||||||
|
// covers anything finer. Kept in step with the XOP presets in `level_caps`.
|
||||||
|
const TIERS: [&str; 4] = ["sop", "op", "halfop", "voice"];
|
||||||
|
|
||||||
|
// ACCESS <#channel> LIST | ADD <account> <sop|op|halfop|voice> | DEL <account>
|
||||||
pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db: &mut dyn Store) {
|
pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db: &mut dyn Store) {
|
||||||
let Some(&chan) = args.get(1) else {
|
let Some(&chan) = args.get(1) else {
|
||||||
ctx.notice(me, from.uid, "Syntax: ACCESS <#channel> LIST | ADD <account|!group> <op|voice> | DEL <account|!group>");
|
ctx.notice(me, from.uid, "Syntax: ACCESS <#channel> LIST | ADD <account|!group> <sop|op|halfop|voice> | DEL <account|!group>");
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
match args.get(2).map(|s| s.to_ascii_uppercase()).as_deref() {
|
match args.get(2).map(|s| s.to_ascii_uppercase()).as_deref() {
|
||||||
|
|
@ -20,12 +24,12 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
|
||||||
},
|
},
|
||||||
Some("ADD") => {
|
Some("ADD") => {
|
||||||
let (Some(&account), Some(&level)) = (args.get(3), args.get(4)) else {
|
let (Some(&account), Some(&level)) = (args.get(3), args.get(4)) else {
|
||||||
ctx.notice(me, from.uid, "Syntax: ACCESS <#channel> ADD <account> <op|voice>");
|
ctx.notice(me, from.uid, "Syntax: ACCESS <#channel> ADD <account> <sop|op|halfop|voice>");
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
let level = level.to_ascii_lowercase();
|
let level = level.to_ascii_lowercase();
|
||||||
if level != "op" && level != "voice" {
|
if !TIERS.contains(&level.as_str()) {
|
||||||
ctx.notice(me, from.uid, "Level must be \x02op\x02 or \x02voice\x02.");
|
ctx.notice(me, from.uid, "Level must be \x02sop\x02, \x02op\x02, \x02halfop\x02 or \x02voice\x02.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if !is_founder(me, from, chan, ctx, db) {
|
if !is_founder(me, from, chan, ctx, db) {
|
||||||
|
|
@ -50,7 +54,7 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
|
||||||
Err(_) => ctx.notice(me, from.uid, "Sorry, that didn't work. Please try again in a moment."),
|
Err(_) => ctx.notice(me, from.uid, "Sorry, that didn't work. Please try again in a moment."),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => ctx.notice(me, from.uid, "Syntax: ACCESS <#channel> LIST | ADD <account|!group> <op|voice> | DEL <account|!group>"),
|
_ => ctx.notice(me, from.uid, "Syntax: ACCESS <#channel> LIST | ADD <account|!group> <sop|op|halfop|voice> | DEL <account|!group>"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,9 @@ const TOPICS: &[HelpEntry] = &[
|
||||||
HelpEntry { cmd: "INFO", summary: "show channel information", detail: "Syntax: \x02INFO <#channel>\x02\nShows a channel's registration and settings." },
|
HelpEntry { cmd: "INFO", summary: "show channel information", detail: "Syntax: \x02INFO <#channel>\x02\nShows a channel's registration and settings." },
|
||||||
HelpEntry { cmd: "LIST", summary: "list registered channels", detail: "Syntax: \x02LIST\x02\nLists registered channels." },
|
HelpEntry { cmd: "LIST", summary: "list registered channels", detail: "Syntax: \x02LIST\x02\nLists registered channels." },
|
||||||
HelpEntry { cmd: "SET", summary: "change founder or settings", detail: "Syntax: \x02SET <#channel> FOUNDER <account> | DESC <text> | URL [address] | EMAIL [address] | SUCCESSOR <account>|OFF | SIGNKICK|PRIVATE|PEACE|SECUREOPS|RESTRICTED|AUTOOP|KEEPTOPIC|TOPICLOCK {ON|OFF}\x02\nTransfers the founder or changes a channel setting." },
|
HelpEntry { cmd: "SET", summary: "change founder or settings", detail: "Syntax: \x02SET <#channel> FOUNDER <account> | DESC <text> | URL [address] | EMAIL [address] | SUCCESSOR <account>|OFF | SIGNKICK|PRIVATE|PEACE|SECUREOPS|RESTRICTED|AUTOOP|KEEPTOPIC|TOPICLOCK {ON|OFF}\x02\nTransfers the founder or changes a channel setting." },
|
||||||
HelpEntry { cmd: "ACCESS", summary: "manage the access list", detail: "Syntax: \x02ACCESS <#channel> LIST | ADD <account|!group> <op|voice> | DEL <account|!group>\x02\nManages the channel access list. The target may be a GroupServ \x02!group\x02; each of its members holding the group's \x02c\x02 flag then inherits the access." },
|
HelpEntry { cmd: "ACCESS", summary: "manage the access list", detail: "Syntax: \x02ACCESS <#channel> LIST | ADD <account|!group> <sop|op|halfop|voice> | DEL <account|!group>\x02\nManages the channel access list. The target may be a GroupServ \x02!group\x02; each of its members holding the group's \x02c\x02 flag then inherits the access." },
|
||||||
HelpEntry { cmd: "FLAGS", summary: "granular per-account flags", detail: "Syntax: \x02FLAGS <#channel> [account [+/-flags]]\x02\nViews or changes granular per-account channel flags." },
|
HelpEntry { cmd: "FLAGS", summary: "granular per-account flags", detail: "Syntax: \x02FLAGS <#channel> [account [+/-flags]]\x02\nViews or changes granular per-account channel flags." },
|
||||||
HelpEntry { cmd: "AOP/SOP/VOP", summary: "tiered access shortcuts", detail: "Syntax: \x02AOP|SOP|VOP <#channel> ADD <account> | DEL <account> | LIST\x02\nTiered shortcuts over ACCESS: AOP and SOP grant op, VOP grants voice." },
|
HelpEntry { cmd: "SOP/AOP/HOP/VOP", summary: "tiered access shortcuts", detail: "Syntax: \x02SOP|AOP|HOP|VOP <#channel> ADD <account> | DEL <account> | LIST\x02\nTiered shortcuts over ACCESS: SOP grants op plus access-list management, AOP grants op, HOP grants halfop, VOP grants voice." },
|
||||||
HelpEntry { cmd: "STATUS", summary: "show a user's access", detail: "Syntax: \x02STATUS <#channel> [nick]\x02\nShows a user's access level on a channel." },
|
HelpEntry { cmd: "STATUS", summary: "show a user's access", detail: "Syntax: \x02STATUS <#channel> [nick]\x02\nShows a user's access level on a channel." },
|
||||||
HelpEntry { cmd: "OP/DEOP/VOICE/DEVOICE", summary: "give or take op/voice", detail: "Syntax: \x02OP|DEOP|VOICE|DEVOICE <#channel> [nick]\x02\nGives or takes channel op or voice." },
|
HelpEntry { cmd: "OP/DEOP/VOICE/DEVOICE", summary: "give or take op/voice", detail: "Syntax: \x02OP|DEOP|VOICE|DEVOICE <#channel> [nick]\x02\nGives or takes channel op or voice." },
|
||||||
HelpEntry { cmd: "UP/DOWN", summary: "apply or drop your status", detail: "Syntax: \x02UP|DOWN <#channel>\x02\nUP re-applies the op/voice your access entitles you to; DOWN removes your status." },
|
HelpEntry { cmd: "UP/DOWN", summary: "apply or drop your status", detail: "Syntax: \x02UP|DOWN <#channel>\x02\nUP re-applies the op/voice your access entitles you to; DOWN removes your status." },
|
||||||
|
|
@ -298,8 +298,9 @@ impl Service for ChanServ {
|
||||||
// the mode lock and akick list, so SYNC is the same handler.
|
// the mode lock and akick list, so SYNC is the same handler.
|
||||||
Some("ENFORCE") | Some("SYNC") => enforce::handle(me, from, args, ctx, net, db),
|
Some("ENFORCE") | Some("SYNC") => enforce::handle(me, from, args, ctx, net, db),
|
||||||
Some("CLONE") => clone::handle(me, from, args, ctx, db),
|
Some("CLONE") => clone::handle(me, from, args, ctx, db),
|
||||||
|
Some("SOP") => xop::handle(me, from, "SOP", "sop", args, ctx, db),
|
||||||
Some("AOP") => xop::handle(me, from, "AOP", "op", args, ctx, db),
|
Some("AOP") => xop::handle(me, from, "AOP", "op", args, ctx, db),
|
||||||
Some("SOP") => xop::handle(me, from, "SOP", "op", args, ctx, db),
|
Some("HOP") => xop::handle(me, from, "HOP", "halfop", args, ctx, db),
|
||||||
Some("VOP") => xop::handle(me, from, "VOP", "voice", args, ctx, db),
|
Some("VOP") => xop::handle(me, from, "VOP", "voice", args, ctx, db),
|
||||||
Some("HELP") => echo_api::help(me, from, ctx, BLURB, TOPICS, args.get(1).copied()),
|
Some("HELP") => echo_api::help(me, from, ctx, BLURB, TOPICS, args.get(1).copied()),
|
||||||
Some(other) => ctx.notice(me, from.uid, format!("I don't know the command \x02{other}\x02. Try \x02HELP\x02.")),
|
Some(other) => ctx.notice(me, from.uid, format!("I don't know the command \x02{other}\x02. Try \x02HELP\x02.")),
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use echo_api::Store;
|
use echo_api::Store;
|
||||||
use echo_api::{Sender, ServiceCtx};
|
use echo_api::{access_role, Sender, ServiceCtx};
|
||||||
use echo_api::NetView;
|
use echo_api::NetView;
|
||||||
|
|
||||||
// STATUS <#channel> [nick]: show a user's access level (self if no nick).
|
// STATUS <#channel> [nick]: show a user's access level (self if no nick).
|
||||||
|
|
@ -19,10 +19,11 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, net:
|
||||||
let level = match account.as_deref() {
|
let level = match account.as_deref() {
|
||||||
None => "none (not logged in)",
|
None => "none (not logged in)",
|
||||||
Some(a) if info.founder.eq_ignore_ascii_case(a) => "founder",
|
Some(a) if info.founder.eq_ignore_ascii_case(a) => "founder",
|
||||||
Some(a) => match info.join_mode(a) {
|
// Classify by resolved tier so halfop and sop read distinctly, matching
|
||||||
Some("+o") => "op",
|
// ALIST and the XOP lists.
|
||||||
Some("+v") => "voice",
|
Some(a) => match info.access.iter().find(|e| e.account.eq_ignore_ascii_case(a)) {
|
||||||
_ => "none",
|
Some(e) => access_role(&e.level).label(),
|
||||||
|
None => "none",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
ctx.notice(me, from.uid, format!("\x02{label}\x02 access on \x02{chan}\x02: \x02{level}\x02"));
|
ctx.notice(me, from.uid, format!("\x02{label}\x02 access on \x02{chan}\x02: \x02{level}\x02"));
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
use echo_api::{level_caps, Sender, ServiceCtx, Store};
|
use echo_api::{access_role, Sender, ServiceCtx, Store};
|
||||||
|
|
||||||
// AOP/SOP/VOP <#channel> ADD <account> | DEL <account> | LIST — tiered
|
// SOP/AOP/HOP/VOP <#channel> ADD <account> | DEL <account> | LIST — tiered
|
||||||
// shortcuts over the access list. `level` is the access level they map to
|
// shortcuts over the access list. `level` is the tier they map to ("sop", "op",
|
||||||
// ("op" for AOP/SOP, "voice" for VOP); `word` is what the user typed.
|
// "halfop", "voice"); `word` is the tier the user typed ("SOP".."VOP").
|
||||||
pub fn handle(me: &str, from: &Sender, word: &str, level: &str, args: &[&str], ctx: &mut ServiceCtx, db: &mut dyn Store) {
|
pub fn handle(me: &str, from: &Sender, word: &str, level: &str, args: &[&str], ctx: &mut ServiceCtx, db: &mut dyn Store) {
|
||||||
let Some(&chan) = args.get(1) else {
|
let Some(&chan) = args.get(1) else {
|
||||||
ctx.notice(me, from.uid, format!("Syntax: {word} <#channel> ADD <account> | DEL <account> | LIST"));
|
ctx.notice(me, from.uid, format!("Syntax: {word} <#channel> ADD <account> | DEL <account> | LIST"));
|
||||||
|
|
@ -13,14 +13,9 @@ pub fn handle(me: &str, from: &Sender, word: &str, level: &str, args: &[&str], c
|
||||||
None => ctx.notice(me, from.uid, format!("\x02{chan}\x02 isn't registered.")),
|
None => ctx.notice(me, from.uid, format!("\x02{chan}\x02 isn't registered.")),
|
||||||
Some(info) => {
|
Some(info) => {
|
||||||
ctx.notice(me, from.uid, format!("{word} list for \x02{}\x02:", info.name));
|
ctx.notice(me, from.uid, format!("{word} list for \x02{}\x02:", info.name));
|
||||||
// Match by capability, not the raw level string, so entries set via
|
// List by resolved tier, not the raw level string, so an entry set
|
||||||
// granular FLAGS still list under the right tier (VOP = voice-only,
|
// via granular FLAGS appears under the same tier a XOP ADD would.
|
||||||
// AOP/SOP = op).
|
for a in info.access.iter().filter(|a| access_role(&a.level).xop_word() == Some(word)) {
|
||||||
let want_op = level_caps(level).op;
|
|
||||||
for a in info.access.iter().filter(|a| {
|
|
||||||
let c = level_caps(&a.level);
|
|
||||||
if want_op { c.op } else { c.auto == Some("+v") && !c.op }
|
|
||||||
}) {
|
|
||||||
ctx.notice(me, from.uid, format!(" \x02{}\x02", a.account));
|
ctx.notice(me, from.uid, format!(" \x02{}\x02", a.account));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use echo_api::{level_caps, Sender, ServiceCtx, Store};
|
use echo_api::{access_role, Sender, ServiceCtx, Store};
|
||||||
|
|
||||||
// ALIST: list the channels the sender's account founds or has access on.
|
// ALIST: list the channels the sender's account founds or has access on.
|
||||||
pub fn handle(me: &str, from: &Sender, ctx: &mut ServiceCtx, db: &dyn Store) {
|
pub fn handle(me: &str, from: &Sender, ctx: &mut ServiceCtx, db: &dyn Store) {
|
||||||
|
|
@ -11,20 +11,9 @@ pub fn handle(me: &str, from: &Sender, ctx: &mut ServiceCtx, db: &dyn Store) {
|
||||||
if c.founder.eq_ignore_ascii_case(account) {
|
if c.founder.eq_ignore_ascii_case(account) {
|
||||||
rows.push((c.name.clone(), "founder"));
|
rows.push((c.name.clone(), "founder"));
|
||||||
} else if let Some(a) = c.access.iter().find(|a| a.account.eq_ignore_ascii_case(account)) {
|
} else if let Some(a) = c.access.iter().find(|a| a.account.eq_ignore_ascii_case(account)) {
|
||||||
// Resolve the entry's capabilities rather than string-matching the
|
// Classify by resolved capability, not the raw level string, so a role
|
||||||
// level, so a role set via granular FLAGS (e.g. "v") reads correctly
|
// set via granular FLAGS reads under the same tier XOP would show.
|
||||||
// and isn't mislabelled "op".
|
rows.push((c.name.clone(), access_role(&a.level).label()));
|
||||||
let caps = level_caps(&a.level);
|
|
||||||
let role = if caps.op {
|
|
||||||
"op"
|
|
||||||
} else if caps.auto == Some("+v") {
|
|
||||||
"voice"
|
|
||||||
} else if caps.auto == Some("+h") {
|
|
||||||
"halfop"
|
|
||||||
} else {
|
|
||||||
"access"
|
|
||||||
};
|
|
||||||
rows.push((c.name.clone(), role));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if rows.is_empty() {
|
if rows.is_empty() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue