} else {
let ag = AccountsGuard::lock();
let auth = authorise_scope_direct(cs, &ag, &AccountScope::Server)?;
- let auth = auth.therefore_ok();
+ let auth = auth.so_promise();
cs.authstate = AuthState::Superuser { euid: preserve_euid, auth };
}
Fine
let good_uid = Some(config().ssh_proxy_uid);
let auth = cs.authorised_uid(good_uid, Some("SetRestrictedScope"))
.map_err(|_| ME::AuthorisationError)?;
- let auth = auth.therefore_ok();
+ let auth = auth.so_promise();
cs.authstate = AuthState::Ssh { key, auth };
Fine
},
cs.account = Some(AccountSpecified {
cooked: wanted_account.to_string(),
notional_account: wanted_account,
- auth: auth.therefore_ok(),
+ auth: auth.so_promise(),
});
Fine
}
execute_for_game(cs, &mut ag, &mut ig,
insns, MgmtGameUpdateMode::Bulk)
.map_err(|e|{
- let ig = ig.by(Authorisation::authorise_any());
+ let ig = ig.by(Authorisation::promise_any());
let name = ig.name.clone();
let InstanceGuard { c, .. } = ig;
Instance::destroy_game(&mut games, c, auth)
MC::ListGames { all } => {
let ag = AccountsGuard::lock();
let names = Instance::list_names(
- None, Authorisation::authorise_any());
+ None, Authorisation::promise_any());
let auth_all = if all == Some(true) {
let auth = cs.superuser().ok_or(ME::AuthorisationError)?.into();
Some(auth)
let (player, update, logentry) =
ig.player_new(gpl, ipl, arecord.account.clone(), logentry)?;
- let atr = ig.player_access_reset(ag, player, auth.therefore_ok())?;
+ let atr = ig.player_access_reset(ag, player, auth.so_promise())?;
(U{ pcs: vec![],
log: vec![ logentry ],
let who = if_chain! {
let account = &cs.current_account()?.notional_account;
- let ig = igu.by_ref(Authorisation::authorise_any());
+ let ig = igu.by_ref(Authorisation::promise_any());
if let Ok((_, acctid)) = ag.lookup(account);
if let Some((player,_)) = ig.iplayers.iter()
.filter(|(_,ipr)| ipr.ipl.acctid == acctid)
execute_game_insn(cs, ag, igu, insn, &who,
&mut to_permute)?;
let st = uh_auth.get_or_insert_with(||{
- let auth = Authorisation::authorised(&*ig.name);
+ let auth = Authorisation::promise_for(&*ig.name);
let uh = UpdateHandler::from_how(how);
St { uh, auth, have_deleted: false }
});
})();
(r, {
- let ig = igu.by_mut(Authorisation::authorise_any());
+ let ig = igu.by_mut(Authorisation::promise_any());
let g = &mut **ig;
let gs = &mut g.gs;
to_permute.implement(&mut gs.players,
});
if let Some(uu) = uu {
- let mut ig = igu.by_mut(Authorisation::authorise_any());
+ let mut ig = igu.by_mut(Authorisation::promise_any());
let mut prepub = PrepareUpdatesBuffer::new(&mut ig, None);
uu(&mut prepub);
prepub.finish();
client_euid == server_uid ||
Some(client_euid) == wanted
{
- return Authorisation::authorised(&client_euid);
+ return Authorisation::promise_for(&client_euid);
}
throw!(anyhow!("{}: euid mismatch: client={:?} server={:?} wanted={:?}{}",
&self.desc, client_euid, server_uid, wanted,
Authorisation<InstanceName>)
{
let ipl_unauth = {
- let ig = ig.by_ref(Authorisation::authorise_any());
+ let ig = ig.by_ref(Authorisation::promise_any());
ig.iplayers.byid(player)?
};
let how = PCH::InstanceOrOnlyAffectedAccount(ipl_unauth.ipl.acctid);
let subject_is = |object_acctid: AccountId|{
if subject_acctid == object_acctid {
let auth: Authorisation<InstanceName>
- = Authorisation::authorise_any();
+ = Authorisation::promise_any();
return Some(auth);
}
return None;
PCH::InstanceOrOnlyAffectedPlayer(object_player) => {
if_chain!{
if let Some(object_ipr) =
- ig.by_ref(Authorisation::authorise_any()).iplayers
+ ig.by_ref(Authorisation::promise_any()).iplayers
.get(object_player);
then { subject_is(object_ipr.ipl.acctid) }
else { None }
let auth = {
let subject = ¤t_account.cooked;
let (acl, owner) = {
- let ig = ig.by_ref(Authorisation::authorise_any());
+ let ig = ig.by_ref(Authorisation::promise_any());
(&ig.acl, &ig.name.account)
};
let owner_account = owner.to_string();
ag.check(¤t.notional_account)?;
if let Some(y) = cs.superuser() {
- return y.therefore_ok();
+ return y.so_promise();
}
if ¤t.notional_account == &wanted.account {
let y: Authorisation<Uid> = {
cs.authorised_uid(None,None)?
};
- y.therefore_ok()
+ y.so_promise()
}
AccountScope::Ssh{..} => {
const SERVER_ONLY: (AuthorisedIf, Authorisation<InUserList>) = (
AuthorisedIf { authorised_for: None },
- Authorisation::authorised(&InUserList),
+ Authorisation::promise_for(&InUserList),
);
let pwent = Passwd::from_name(&wanted)
"requested username {:?} not found", &wanted
))
)?;
- let pwent_ok = Authorisation::authorised(&pwent);
+ let pwent_ok = Authorisation::promise_for(&pwent);
let ((uid, in_userlist_ok), xinfo) = (||{ <Result<_,AE>>::Ok({
let allowed = BufReader::new(match File::open(USERLIST) {
(AuthorisedIf{ authorised_for: Some(
Uid::from_raw(pwent.uid)
)},
- Authorisation::authorised(&InUserList),
+ Authorisation::promise_for(&InUserList),
),
None
))
(pwent_ok, uid_ok, in_userlist_ok).combine()
};
- y.therefore_ok()
+ y.so_promise()
},
}