OperServ: temporary OPER grants that auto-expire

OPER ADD <account> <priv[,priv]> [+duration] now takes an optional window,
after which the grant lazily stops conferring privileges — no timer, the
oper_privs merge just hides an expired grant (evaluated on the engine's
clock so it's testable). Permanent grants are unchanged; LIST flags the
temporary ones and hides expired entries. Runtime opers now carry an
OperGrant{privs, expires} instead of a bare priv list.
This commit is contained in:
Jean Chevronnet 2026-07-14 02:29:03 +00:00
parent 90824513a7
commit 85d01b3ebf
No known key found for this signature in database
4 changed files with 113 additions and 39 deletions

View file

@ -780,10 +780,11 @@ pub trait Store {
fn news_add(&mut self, kind: &str, text: &str, setter: &str) -> u64;
fn news_del(&mut self, id: u64) -> bool;
fn news(&self, kind: &str) -> Vec<NewsView>;
// Runtime operator grants (OperServ OPER), merged with config opers.
fn oper_grant(&mut self, account: &str, privs: Vec<String>);
// Runtime operator grants (OperServ OPER), merged with config opers. `expires`
// is an absolute unix time (None = permanent); opers_list hides expired ones.
fn oper_grant(&mut self, account: &str, privs: Vec<String>, expires: Option<u64>);
fn oper_revoke(&mut self, account: &str) -> bool;
fn opers_list(&self) -> Vec<(String, Vec<String>)>;
fn opers_list(&self) -> Vec<(String, Vec<String>, Option<u64>)>;
// Session-limit exceptions (OperServ SESSION EXCEPTION).
fn session_except_add(&mut self, mask: &str, limit: u32, reason: &str);
fn session_except_del(&mut self, mask: &str) -> bool;