I made some changes and used your Spacebars.toHTML but it still get stucked and it’s like the job remain suspended. But nothing works and I have no log in the console. Everything is blocked at this line:
execSync( cmd );
here the complete method:
'render.pdf': (menu) => {
console.log('######################################### 1');
let dataContext = {
categories: () => {
Category.find({}, {sort: {categoryOrder: 1}});
}
}
// let html = SSR.compileTemplate('menuPrivate', Assets.getText('menuPrivate.html'));
let html = Spacebars.toHTML( dataContext, Assets.getText('menuPrivate.html') );
console.log('######################################### 2')
// generate file name and path
let filePath;
let filename = `menu.html`;
console.log('######################################### 3 define file name')
if ( process.env.NODE_ENV === 'development' ) {
filePath = '/tmp/' + filename;
} else {
let path = Npm.require('path');
filePath = path.join( process.env.TEMP_DIR, filename );
}
console.log('######################################### 4 saved')
// write html to file
let fs = Npm.require('fs');
let writeFileSync = Meteor.wrapAsync( fs.writeFile );
try {
writeFileSync( filePath, html );
} catch ( error ) {
console.log( 'Error writing html to file:');
console.log( error );
}
console.log('######################################### 5 saved')
console.log('#########################################', filePath)
// call phantom to render pdf from html
let childProcess = Npm.require('child_process');
console.log('######################################### 6')
let cmd = 'phantomjs assets/app/phantom-driver.js ' + filePath;
console.log('######################################### 7')
let execSync = Meteor.wrapAsync( childProcess.exec );
console.log('######################################### 8', cmd)
console.log('######################################### 8', execSync)
try {
execSync( cmd );
console.log('######################################### 9 cmd');
} catch ( error ) {
console.log( 'Error phantomjs:');
console.log( error );
}
// // attach pdf to email
// console.log('######################################### 10');
// email.attachments = [{
// fileName: `menu.pdf`,
// filePath: filePath.replace('.html', '.pdf'),
// }];
// console.log('######################################### 11 cmd');
// // and send the email
// Email.send( email );
},
In the instance that multiple parties are authorized recipients, then I
would
reason that each of those parties are empowered with editing rights.
Interestingly enough, although adding a bit of complexity, the document
could be
area mapped; whereby one recipient is empowered to edit certain regions and
another is empowered to edit other regions.
Or more simply: even with multiple recipients, only some recipients could
be
empowered to edit; visa vi either a password, or key micro-client or
blockchain
style with a certain key.
I don’t think this answer addresses the heart of the question.
What happens when two people are given access to the same area? Not necessarily by you. You know how humans are. They will share the password with each other if they feel it makes their life easier.