chiark / gitweb /
sort out some rawtoken permission check
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 13 Nov 2020 19:15:33 +0000 (19:15 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 13 Nov 2020 19:15:33 +0000 (19:15 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/accounts.rs
src/cmdlistener.rs
src/commands.rs
src/global.rs

index b9083c899b1be82f8a63ecc3ef1ca72f9cad112c..71fd276b0b0d8e5068fbaad124ea9ed53af9b0d9 100644 (file)
@@ -311,7 +311,7 @@ impl AccountsGuard {
       &mut self,
       key: K,
       auth: Authorisation<AccountName>,
-      set_access: Option<Arc<dyn PlayerAccessSpec>>,
+      set_access: Option<AccessRecord>,
       f: F
     )
     -> Result<T, (InternalError, T)>
@@ -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();
index 4e7784553d4bab162a7da7f3e12b9d9abb9db8a3..f73a5a2ecfd4b78ba95ef21d6cb7567c0f19c9ba 100644 (file)
@@ -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<T>(spec: Option<T>, record: &mut T) {
           if let Some(new) = spec { *record = new; }
index 65e96bc4c1081366284fea8fab7ca4dc3996029e..83b712a0916be8bf801956fee0f0590d4cb1a977 100644 (file)
@@ -75,7 +75,6 @@ pub enum MgmtGameInstruction {
   DeletePiece(PieceId),
 
   ResetPlayerAccess(PlayerId),
-  // xxx ^ prevent use of Fixed when not wanted
   RedeliverPlayerAccess(PlayerId),
 
   JoinGame { details: MgmtPlayerDetails },
index 29cceadce3e2f3c3db1211a60fa848be829e10cc..0c95e29fedba01247bb0e78c1e46c6946361be7b 100644 (file)
@@ -729,7 +729,6 @@ impl<'ig> InstanceGuard<'ig> {
                              player: PlayerId,
                              auth: Authorisation<AccountName>)
                              -> Option<AccessTokenReport> {
-    // xxx call this function when access method changes
     self.player_access_reset_redeliver(accounts, player, auth, true)?
   }