The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/server/startup/migrations/v084.js

27 lines
901 B

import { Migrations } from '../../../app/migrations';
import { Permissions } from '../../../app/models';
Migrations.add({
version: 84,
up() {
if (Permissions) {
// Update permission name, copy values from old name
const oldPermission = Permissions.findOne('add-user-to-room');
if (oldPermission && oldPermission.roles.length) {
Permissions.upsert({ _id: 'add-user-to-joined-room' }, { $set: { roles: oldPermission.roles } });
Permissions.remove({ _id: 'add-user-to-room' });
}
}
},
down() {
if (Permissions) {
// Revert permission name, copy values from updated name
const newPermission = Permissions.findOne('add-user-to-joined-room');
if (newPermission && newPermission.roles.length) {
Permissions.upsert({ _id: 'add-user-to-room' }, { $set: { roles: newPermission.roles } });
Permissions.remove({ _id: 'add-user-to-joined-room' });
}
}
},
});