Make sure users can't block themselves with SF allow list

pull/1/head
yflory 5 years ago
parent 835f531c9e
commit d73b32a05e

@ -78,6 +78,7 @@ define([
Realtime.whenRealtimeSyncs(s.realtime, waitFor());
if (s.sharedFolders && typeof (s.sharedFolders) === "object") {
for (var k in s.sharedFolders) {
if (!s.sharedFolders[k].realtime) { continue; } // Deprecated
Realtime.whenRealtimeSyncs(s.sharedFolders[k].realtime, waitFor());
}
}

@ -214,6 +214,18 @@ define([
});
} catch (e) {}
delete allSharedFolders[secret.channel];
// This shouldn't be called on init because we're calling "isNewChannel" first,
// but we can still call "cb" just in case. This wait we make sure we won't block
// the initial "waitFor"
return void cb();
}
if (info.error === "ERESTRICTED" ) {
// This shouldn't happen: allow list are disabled for shared folders
// but call "cb" to make sure we won't block the initial "waitFor"
sf.teams.forEach(function (obj) {
obj.store.manager.restrictedProxy(obj.id, secret.channel);
});
return void cb();
}
}
});

@ -67,6 +67,13 @@ define([
}
};
var restrictedProxy = function (Env, id, channel) {
var lm = { proxy: { deprecated: true } };
removeProxy(Env, id);
addProxy(Env, id, lm, function () {});
return void Env.Store.refreshDriveUI();
};
/*
Tools
*/
@ -1118,6 +1125,7 @@ define([
addProxy: callWithEnv(addProxy),
removeProxy: callWithEnv(removeProxy),
deprecateProxy: callWithEnv(deprecateProxy),
restrictedProxy: callWithEnv(restrictedProxy),
addSharedFolder: callWithEnv(_addSharedFolder),
// Drive
command: callWithEnv(onCommand),

Loading…
Cancel
Save