2019-08-30 17:17:25 +02:00
|
|
|
Meteor.publish('people', function(query, limit) {
|
|
|
|
|
check(query, Match.OneOf(Object, null));
|
2017-11-08 11:27:59 +07:00
|
|
|
check(limit, Number);
|
2018-06-12 21:13:50 +03:00
|
|
|
|
|
|
|
|
if (!Match.test(this.userId, String)) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const user = Users.findOne(this.userId);
|
|
|
|
|
if (user && user.isAdmin) {
|
2019-09-04 22:26:00 +03:00
|
|
|
return Users.find(query, {
|
|
|
|
|
limit,
|
|
|
|
|
sort: { createdAt: -1 },
|
|
|
|
|
fields: {
|
|
|
|
|
username: 1,
|
|
|
|
|
'profile.fullname': 1,
|
|
|
|
|
isAdmin: 1,
|
|
|
|
|
emails: 1,
|
|
|
|
|
createdAt: 1,
|
|
|
|
|
loginDisabled: 1,
|
|
|
|
|
authenticationMethod: 1,
|
|
|
|
|
},
|
|
|
|
|
});
|
2018-06-12 21:13:50 +03:00
|
|
|
}
|
2019-08-30 17:17:25 +02:00
|
|
|
|
|
|
|
|
return [];
|
2017-11-07 14:01:27 +07:00
|
|
|
});
|