From: Ian Jackson Date: Fri, 13 Nov 2020 19:15:33 +0000 (+0000) Subject: sort out some rawtoken permission check X-Git-Tag: otter-0.2.0~528 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=659b754f749e86e0c73d01e043d5e7595a370e42;p=otter.git sort out some rawtoken permission check Signed-off-by: Ian Jackson --- diff --git a/src/accounts.rs b/src/accounts.rs index b9083c89..71fd276b 100644 --- a/src/accounts.rs +++ b/src/accounts.rs @@ -311,7 +311,7 @@ impl AccountsGuard { &mut self, key: K, auth: Authorisation, - set_access: Option>, + set_access: Option, f: F ) -> Result @@ -323,7 +323,7 @@ impl AccountsGuard { acctid, |ig, player| ig.invalidate_tokens(player) )?; - entry.access = AccessRecord(new_access); + entry.access = new_access; } let output = f(&mut *entry, acctid); let ok = self.save_accounts_now(); diff --git a/src/cmdlistener.rs b/src/cmdlistener.rs index 4e778455..f73a5a2e 100644 --- a/src/cmdlistener.rs +++ b/src/cmdlistener.rs @@ -109,7 +109,7 @@ fn execute(cs: &mut CommandStream, cmd: MgmtCommand) -> MgmtResponse { UpdateAccont(AccountDetails { account, nick, timezone, access }) => { let mut ag = AccountsGuard::lock(); let auth = authorise_for_account(cs, &ag, &account)?; - let access = access.map(Into::into); + let access = cs.accountrecord_from_spec(access)?; ag.with_entry_mut(&account, auth, access, |record, _acctid|{ fn update_from(spec: Option, record: &mut T) { if let Some(new) = spec { *record = new; } diff --git a/src/commands.rs b/src/commands.rs index 65e96bc4..83b712a0 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -75,7 +75,6 @@ pub enum MgmtGameInstruction { DeletePiece(PieceId), ResetPlayerAccess(PlayerId), - // xxx ^ prevent use of Fixed when not wanted RedeliverPlayerAccess(PlayerId), JoinGame { details: MgmtPlayerDetails }, diff --git a/src/global.rs b/src/global.rs index 29cceadc..0c95e29f 100644 --- a/src/global.rs +++ b/src/global.rs @@ -729,7 +729,6 @@ impl<'ig> InstanceGuard<'ig> { player: PlayerId, auth: Authorisation) -> Option { - // xxx call this function when access method changes self.player_access_reset_redeliver(accounts, player, auth, true)? }