// management API implementation
use super::*;
+use otter::commands::*;
use authproofs::*;
Err(if needed & test_existence != 0 {
P::NOT_FOUND
} else {
- MgmtError::AuthorisationError
+ ME::AuthorisationError
})?
}
}
use argparse::action::{Action,IFlagAction,IArgAction};
use derive_more::Display;
+use otter::commands::*;
use otter::imports::*;
type APE = ArgumentParseError;
*/
#[throws(AE)]
fn get_pieces(&mut self) -> Vec<MgmtGamePieceInfo> {
- let insns = vec![ MgmtGameInstruction::ListPieces ];
+ let insns = vec![ MGI::ListPieces ];
let mut responses = self.alter_game(insns, None)?;
match responses.as_mut_slice() {
- [MgmtGameResponse::Pieces(pieces)] => return mem::take(pieces),
+ [MGR::Pieces(pieces)] => return mem::take(pieces),
wat => Err(anyhow!("ListPieces => {:?}", &wat))?,
}
}
}
}
+from_instance_lock_error!{MgmtError}
+
impl AccessTokenInfo {
pub fn report(self) -> Vec<String> {
vec![
impl<X> From<PoisonError<X>> for InstanceLockError {
fn from(_: PoisonError<X>) -> Self { Self::GameCorrupted }
}
-from_instance_lock_error!{MgmtError}
pub struct PrivateCaller(());
// outsiders cannot construct this
use hash_map::Entry::*;
let entry = match entry {
Vacant(ve) => ve,
- Occupied(_) => throw!(MgmtError::AlreadyExists),
+ Occupied(_) => throw!(ME::AlreadyExists),
};
ig.save_access_now()?;
Unauthorised::of(
games_table
.get(name)
- .ok_or(MgmtError::GameNotFound)?
+ .ok_or(ME::GameNotFound)?
.clone()
.into()
)
// we have a thing to serialise with the player in it
self.check_new_nick(&gnew.nick)?;
if self.c.g.iplayers.values().any(|r| r.ipl.acctid == inew.acctid) {
- Err(MgmtError::AlreadyExists)?;
+ Err(ME::AlreadyExists)?;
}
let player = self.c.g.gs.players.insert(gnew);
let u = PlayerUpdates::new_begin(&self.c.g.gs).new();
#[throws(MgmtError)]
pub fn check_new_nick(&mut self, new_nick: &str) {
if self.c.g.gs.players.values().any(|old| old.nick == new_nick) {
- Err(MgmtError::NickCollision)?;
+ Err(ME::NickCollision)?;
}
}
pub use crate::accounts::*;
pub use crate::authproofs::{self, Authorisation, Unauthorised};
pub use crate::authproofs::AuthorisationSuperuser;
-pub use crate::commands::*;
+pub use crate::commands::{AccessTokenInfo, AccessTokenReport, MgmtError};
pub use crate::config::*;
pub use crate::debugreader::DebugReader;
pub use crate::error::*;
// There is NO WARRANTY.
use crate::imports::*;
+use crate::commands::*;
#[derive(Debug,Error)]
pub enum MgmtChannelReadError {
#[throws(MgmtError)]
pub fn list_glob(&self, pat: &str) -> Vec<ItemEnquiryData> {
- let pat = glob::Pattern::new(pat).map_err(|pe| MgmtError::BadGlob {
+ let pat = glob::Pattern::new(pat).map_err(|pe| ME::BadGlob {
pat: pat.to_string(), msg: pe.msg.to_string() })?;
let mut out = vec![];
for (k,v) in &self.items {
impl loaded_acl::Perm for TablePermission {
type Auth = InstanceName;
const TEST_EXISTENCE: Self = TablePermission::TestExistence;
- const NOT_FOUND: MgmtError = MgmtError::GameNotFound;
+ const NOT_FOUND: MgmtError = ME::GameNotFound;
}
impl TablePlayerSpec {