kopia lustrzana https://github.com/c9/core
When a user is removed from a project, kill their VFS session
rodzic
f46f266c0a
commit
586ea62b29
|
@ -336,9 +336,31 @@ function plugin(options, imports, register) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handlePublish(vfs, messageString) {
|
||||||
|
var message = JSON.parse(messageString);
|
||||||
|
switch (message.action) {
|
||||||
|
case "remove_member":
|
||||||
|
handleRemoveProjectMember(vfs, message);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRemoveProjectMember(vfs, message) {
|
||||||
|
if (vfs.uid !== message.body.uid) return;
|
||||||
|
|
||||||
|
console.log("Removing ", vfs.id, " for user ", vfs.uid, " project ", vfs.pid, " from the vfs connection cache");
|
||||||
|
// Remove after 2s so client has time to recieve final "You've been removed" PubSub message.
|
||||||
|
setTimeout(function() {
|
||||||
|
cache.remove(vfs.id);
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
register(null, {
|
register(null, {
|
||||||
"vfs.server": {
|
"vfs.server": {
|
||||||
get section() { return section; }
|
get section() { return section; },
|
||||||
|
get handlePublish() { return handlePublish; }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue