let ag = AccountsGuard::lock();
let gref = Instance::lookup_by_name_unauth(&game)?;
let mut igu = gref.lock()?;
- let (ig, auth) = cs.check_acl(&ag, &mut igu, PCH::Instance,
+ let (ig, _) = cs.check_acl(&ag, &mut igu, PCH::Instance,
TP_ACCESS_BUNDLES)?;
- let f = id.open(&ig.name,auth.bundles())?
- .ok_or_else(|| ME::BundleNotFound)?;
+ let f = id.open(&ig)?.ok_or_else(|| ME::BundleNotFound)?;
bulk_download = Some(Box::new(f));
Fine
}
}
#[throws(IE)]
- pub fn open(&self, instance_name: &InstanceName,
- _: Authorisation<Id>) -> Option<fs::File> {
+ pub fn open_by_name(&self, instance_name: &InstanceName,
+ _: Authorisation<Id>) -> Option<fs::File> {
let path = self.path(instance_name);
match File::open(&path) {
Ok(f) => Some(f),
),
}
}
+
+ #[throws(IE)]
+ pub fn open(&self, instance: &Instance) -> Option<fs::File> {
+ let name = &*instance.name;
+ let auth = Authorisation::authorised(name).bundles();
+ self.open_by_name(name, auth)?
+ }
}
#[derive(Debug,Copy,Clone,Error)]