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

19 lines
578 B

import { Migrations } from '../../../app/migrations';
import { Settings, Roles, Permissions } from '../../../app/models';
import { settings } from '../../../app/settings';
Migrations.add({
version: 136,
up() {
const personalTokensEnabled = settings.get('API_Enable_Personal_Access_Tokens');
const roles = Roles.find({ scope: 'Users' }).fetch().map((role) => role._id);
if (personalTokensEnabled) {
Permissions.upsert({ _id: 'create-personal-access-tokens' }, { $set: { roles } });
}
Settings.remove({
_id: 'API_Enable_Personal_Access_Tokens',
});
},
});