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.hash = data.hash;
teamData.keys.drive.edPrivate = data.keys.drive.edPrivate; teamData.keys.drive.edPrivate = data.keys.drive.edPrivate;
teamData.keys.chat.edit = data.keys.chat.edit; 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); var secret = Hash.getSecrets('team', data.hash, teamData.password);
team.secondaryKey = secret && secret.keys.secondaryKey; team.secondaryKey = secret && secret.keys.secondaryKey;
var crypto = Crypto.createEncryptor(secret.keys);
team.listmap.setReadOnly(false, crypto);
} else { } else {
delete teamData.hash; delete teamData.hash;
delete teamData.keys.drive.edPrivate; delete teamData.keys.drive.edPrivate;
@ -1150,6 +1155,8 @@ define([
if (team.rpc && team.rpc.destroy) { if (team.rpc && team.rpc.destroy) {
team.rpc.destroy(); team.rpc.destroy();
} }
team.manager.removePin();
team.listmap.setReadOnly(true);
} }
updateMyRights(ctx, teamId, data.hash); 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 { return {
// Manager // Manager
addProxy: callWithEnv(addProxy), addProxy: callWithEnv(addProxy),
@ -1250,6 +1259,8 @@ define([
deprecateProxy: callWithEnv(deprecateProxy), deprecateProxy: callWithEnv(deprecateProxy),
restrictedProxy: callWithEnv(restrictedProxy), restrictedProxy: callWithEnv(restrictedProxy),
addSharedFolder: callWithEnv(_addSharedFolder), addSharedFolder: callWithEnv(_addSharedFolder),
addPin: addPin,
removePin: removePin,
// Drive // Drive
command: callWithEnv(onCommand), command: callWithEnv(onCommand),
getPadAttribute: callWithEnv(getPadAttribute), getPadAttribute: callWithEnv(getPadAttribute),

Loading…
Cancel
Save