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/packages/rocketchat-importer/server/methods/getImportProgress.js

27 lines
824 B

import { Meteor } from 'meteor/meteor';
import { Importers } from 'meteor/rocketchat:importer';
import { RocketChat } from 'meteor/rocketchat:lib';
Meteor.methods({
getImportProgress(key) {
if (!Meteor.userId()) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'getImportProgress' });
}
if (!RocketChat.authz.hasPermission(Meteor.userId(), 'run-import')) {
throw new Meteor.Error('error-action-not-allowed', 'Importing is not allowed', { method: 'setupImporter' });
}
const importer = Importers.get(key);
if (!importer) {
throw new Meteor.Error('error-importer-not-defined', `The importer (${ key }) has no import class defined.`, { method: 'getImportProgress' });
}
if (!importer.instance) {
return undefined;
}
return importer.instance.getProgress();
},
});