peerlibrary:user-extra

v0.5.0Published 5 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

Extended Meteor.userId() and Meteor.user()

Adding this package to your Meteor application:

  • makes Meteor.userId() work also inside the publish endpoint functions (even for Meteor versions prior to 1.5.1)
  • prevents direct modification of the user's profile from the client, which is otherwise allowed by Meteor
  • extends Meteor.user(userId) into Meteor.user(userId, fields) which now accepts an argument to limit queried fields (and thus function's reactivity); userId is optional and if not specified Meteor.userId() is used instead

Both client and server side.

Installation

meteor add peerlibrary:user-extra

Examples

1Template.user.helpers({
2  username: function () {
3    var user = Meteor.user({username: 1});
4    return user && user.username;
5  }
6});