Steffo Weber, ForgeRock
ACM/GI Meeting Feb 2015
*Title courtesy of @guyroyse
Live Coding.
Meteor.publish('users', function() {
var userId = this.userId,
user = Meteor.users.findOne({
_id: userId
}),
email = user.emails[0].address;
return UsersCollection.find({
'userid': email
}
})
Meteor.users.allow({
'update': function (userId, doc, fieldNames, modifier)) {
if (Roles.userIsInRole(userId, 'admin')) {
return true;
} else {
//console.log("Restricting access to own docs.");
return doc.owner === userId;
}
}
})