let ag = AccountsGuard::lock();
let gref = Instance::lookup_by_name_unauth(&game)?;
let mut igu = gref.lock()?;
- let (ig, _) = cs.check_acl(&ag, &mut igu, PCH::Instance,
+ let (ig, auth) = cs.check_acl(&ag, &mut igu, PCH::Instance,
TP_ACCESS_BUNDLES)?;
- let f = id.open(&ig.name)?.ok_or_else(|| ME::BundleNotFound)?;
+ let f = id.open(&ig.name,auth.bundles())?
+ .ok_or_else(|| ME::BundleNotFound)?;
bulk_download = Some(Box::new(f));
Fine
}
#[derive(Serialize,Deserialize)]
pub struct Id { pub index: Index, pub kind: Kind, }
+impl Authorisation<InstanceName> {
+ pub fn bundles(self) -> Authorisation<Id> { self.therefore_ok() }
+}
+
#[derive(Debug,Clone)]
pub struct InstanceBundles {
// todo: this vec is needed during loading only!
}
#[throws(IE)]
- pub fn open(&self, instance_name: &InstanceName) -> Option<fs::File> {
+ pub fn open(&self, instance_name: &InstanceName,
+ _: Authorisation<Id>) -> Option<fs::File> {
let path = self.path(instance_name);
match File::open(&path) {
Ok(f) => Some(f),