Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Make sure the user is logged in before changing collections
if (!Meteor.userId()) {
throw new Meteor.Error('not-authorized');
}
// Ensure user is moderator before sending the agenda
let userRoles = new UserRoles(Meteor.userId());
let aMin = new Minutes(id);
if (userRoles.isModeratorOf(aMin.parentMeetingSeriesID())) {
if (!GlobalSettings.isEMailDeliveryEnabled()) {
console.log('Skip sending mails because email delivery is not enabled. To enable email delivery set enableMailDelivery to true in your settings.json file');
throw new Meteor.Error('Cannot send agenda', 'Email delivery is not enabled in your 4minitz installation.');
}
if (!Meteor.isClient) {
let emails = Meteor.user().emails;
let senderEmail = (emails && emails.length > 0)
? emails[0].address
: GlobalSettings.getDefaultEmailSenderAddress();
let sendAgendaMailHandler = new SendAgendaMailHandler(senderEmail, aMin);
sendAgendaMailHandler.send();
MinutesSchema.update({_id: aMin._id, isFinalized: false}, {$set: {agendaSentAt: new Date()}});
return sendAgendaMailHandler.getCountRecipients();
}
} else {
throw new Meteor.Error('Cannot send agenda', 'You are not moderator of the parent meeting series.');
}
},
'minutes.updateTopic'(topicId, doc) {
check(topicId, String);
console.log(`updateTopic: ${topicId}`);
// Make sure the user is logged in before changing collections
if (!Meteor.userId()) {
throw new Meteor.Error('not-authorized', 'You are not authorized to perform this action.');
}
doc.updatedAt = new Date();
doc.updatedBy = User.PROFILENAMEWITHFALLBACK(Meteor.user());
let modifierDoc = {};
for (let property in doc) {
if (doc.hasOwnProperty(property)) {
modifierDoc['topics.$.' + property] = doc[property];
}
}
let minDoc = MinutesSchema.findOne({isFinalized: false, 'topics._id': topicId});
let aMin = new Minutes(minDoc);
// Ensure user can not update documents of other users
let userRoles = new UserRoles(Meteor.userId());
if (userRoles.isModeratorOf(aMin.parentMeetingSeriesID())) {
// Ensure user can not update finalized minutes
display: true,
icon: `${Meteor.absoluteUrl()}resources/email-templates/facebook-icon.png`,
link: "https://www.facebook.com"
},
googlePlus: {
display: true,
icon: `${Meteor.absoluteUrl()}resources/email-templates/google-plus-icon.png`,
link: "https://plus.google.com"
},
twitter: {
display: true,
icon: `${Meteor.absoluteUrl()}resources/email-templates/twitter-icon.png`,
link: "https://www.twitter.com"
}
},
user: Meteor.user(), // Account Data
currentUserName,
invitedUserName: name,
url: url || getEmailUrl(token)
};
function getEmailUrl(userToken) {
if (userToken) {
return MeteorAccounts.urls.enrollAccount(userToken);
}
return Meteor.absoluteUrl();
}
}
export default createContainer((props) => {
return {
currentUser: Meteor.user(),
// settings: Settings.findOne({})
};
}, Login);
componentDidUpdate() {
if (Meteor.user()) {
console.log('go dashboard');
goPage('dashboard');
}
}
render () {
alreadyInvest() {
const user = Meteor.user();
if (user) {
const userId = user._id;
const invest = this.invest;
const investData = _.findWhere(invest, { userId });
if (investData) {
return investData.amount;
}
}
return 0;
},
cardDisplayClass() {
fscAnnouncement(userId, message) {
check(this.userId, String);
check(userId, [String]);
check(message, String);
fscAnnouncement(Meteor.user(), userId, message);
return true;
}
});
static isCompleted (user = undefined) {
let birthname, givenname, email;
if (user === undefined) {
birthname = Meteor.user().profile.birthname !== "" && Meteor.user().profile.birthname !== undefined;
givenname = Meteor.user().profile.givenname !== "" && Meteor.user().profile.givenname !== undefined;
email = Meteor.user().email !== "" && Meteor.user().email !== undefined;
} else {
birthname = user.profile.birthname !== "" && user.profile.birthname !== undefined;
givenname = user.profile.givenname !== "" && user.profile.givenname !== undefined;
email = user.email !== "" && user.email !== undefined;
}
return (birthname && givenname && email);
}
};
gotCardIndex: function () {
if (Meteor.user() && Meteor.user().count !== undefined) {
return Meteor.user().count.transcripts > 0;
}
}
});
takeDownAdvertising(advertisingId) {
check(this.userId, String);
check(advertisingId, String);
takeDownAdvertising(Meteor.user(), advertisingId);
return true;
}
});