mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
Fix team access list issue #1972
This commit is contained in:
parent
5aa8dfad51
commit
d8cd653b08
@ -107,6 +107,10 @@ HK.authenticateNetfluxSession = function (Env, netfluxId, unsafeKey) {
|
||||
var user = Env.netfluxUsers[netfluxId] = Env.netfluxUsers[netfluxId] || {};
|
||||
user[unsafeKey] = +new Date();
|
||||
};
|
||||
HK.unauthenticateNetfluxSession = function (Env, netfluxId, unsafeKey) {
|
||||
var user = Env.netfluxUsers[netfluxId] = Env.netfluxUsers[netfluxId] || {};
|
||||
delete user[unsafeKey];
|
||||
};
|
||||
|
||||
HK.closeNetfluxSession = function (Env, netfluxId) {
|
||||
delete Env.netfluxUsers[netfluxId];
|
||||
|
||||
@ -72,6 +72,7 @@ const AUTHENTICATED_USER_SCOPED = {
|
||||
REMOVE_PINS: Pinning.removePins,
|
||||
TRIM_PINS: Pinning.trimPins,
|
||||
COOKIE: Core.haveACookie,
|
||||
DESTROY: () => {}
|
||||
};
|
||||
|
||||
var isAuthenticatedCall = function (call) {
|
||||
@ -190,6 +191,11 @@ var rpc = function (Env, Server, userId, data, respond) {
|
||||
if (command === 'COOKIE' && !hadSession && Env.logIP) {
|
||||
Env.Log.info('NEW_RPC_SESSION', {userId: userId, publicKey: publicKey});
|
||||
}
|
||||
if (command === "DESTROY") {
|
||||
HK.unauthenticateNetfluxSession(Env, userId, publicKey);
|
||||
return; // No need to respond, user will close the session
|
||||
}
|
||||
|
||||
HK.authenticateNetfluxSession(Env, userId, publicKey);
|
||||
return void handleAuthenticatedMessage(Env, publicKey, msg, respond, Server);
|
||||
});
|
||||
|
||||
@ -264,6 +264,8 @@ var factory = function (Util, Nacl) {
|
||||
clearTimeout(to);
|
||||
});
|
||||
|
||||
ctx.send('DESTROY', "", function () {});
|
||||
|
||||
// remove the ctx from the network's stack
|
||||
var idx = networkContext.authenticated.indexOf(ctx);
|
||||
if (idx === -1) { return; }
|
||||
|
||||
@ -107,6 +107,7 @@ const factory = (Util, Hash, Constants, Realtime, ProxyManager,
|
||||
try { team.roster.stop(); } catch (e) {}
|
||||
team.proxy = {};
|
||||
team.stopped = true;
|
||||
team?.rpc?.destroy();
|
||||
delete ctx.teams[teamId];
|
||||
delete ctx.cache[teamId];
|
||||
delete ctx.store.proxy.teams[teamId];
|
||||
|
||||
2
www/common/worker.bundle.min.js
vendored
2
www/common/worker.bundle.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user