wekan/server/publications/people.js

32 lines
649 B
JavaScript
Raw Normal View History

2019-08-30 17:17:25 +02:00
Meteor.publish('people', function(query, limit) {
check(query, Match.OneOf(Object, null));
check(limit, Number);
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,
'profile.initials': 1,
2019-09-04 22:26:00 +03:00
isAdmin: 1,
emails: 1,
createdAt: 1,
loginDisabled: 1,
authenticationMethod: 1,
importUsernames: 1,
orgs: 1,
teams: 1,
2019-09-04 22:26:00 +03:00
},
});
}
2019-08-30 17:17:25 +02:00
return [];
});