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/v027.js

32 lines
529 B

RocketChat.Migrations.add({
version: 27,
up() {
RocketChat.models.Users.update({}, {
$rename: {
roles: '_roles'
}
}, {
multi: true
});
RocketChat.models.Users.find({
_roles: {
$exists: 1
}
}).forEach((user) => {
for (const scope of Object.keys(user._roles)) {
const roles = user._roles[scope];
RocketChat.models.Roles.addUserRoles(user._id, roles, scope);
}
});
return RocketChat.models.Users.update({}, {
$unset: {
_roles: 1
}
}, {
multi: true
});
}
});