Fix team edit rights not applied without a worker reload

pull/1/head
yflory 4 years ago
parent 4faad7ba83
commit fff2956393

@ -1138,10 +1138,15 @@ define([
teamData.hash = data.hash;
teamData.keys.drive.edPrivate = data.keys.drive.edPrivate;
teamData.keys.chat.edit = data.keys.chat.edit;
initRpc(ctx, team, teamData.keys.drive, function () {});
initRpc(ctx, team, teamData.keys.drive, function () {
team.manager.addPin(team.pin, team.unpin);
});
var secret = Hash.getSecrets('team', data.hash, teamData.password);
team.secondaryKey = secret && secret.keys.secondaryKey;
var crypto = Crypto.createEncryptor(secret.keys);
team.listmap.setReadOnly(false, crypto);
} else {
delete teamData.hash;
delete teamData.keys.drive.edPrivate;
@ -1150,6 +1155,8 @@ define([
if (team.rpc && team.rpc.destroy) {
team.rpc.destroy();
}
team.manager.removePin();
team.listmap.setReadOnly(true);
}
updateMyRights(ctx, teamId, data.hash);

@ -1243,6 +1243,15 @@ define([
};
};
var addPin = function (pin, unpin) {
Env.pinPads = pin;
Env.unpinPads = unpin;
};
var removePin = function (pin, unpin) {
delete Env.pinPads;
delete Env.unpinPads;
};
return {
// Manager
addProxy: callWithEnv(addProxy),
@ -1250,6 +1259,8 @@ define([
deprecateProxy: callWithEnv(deprecateProxy),
restrictedProxy: callWithEnv(restrictedProxy),
addSharedFolder: callWithEnv(_addSharedFolder),
addPin: addPin,
removePin: removePin,
// Drive
command: callWithEnv(onCommand),
getPadAttribute: callWithEnv(getPadAttribute),

Loading…
Cancel
Save