<commit_before>Meteor.publish("groups", function() {
    return publishGroups(this);
});
Meteor.publish("usersInGroup", function(groupId) {
    return Meteor.users.find({'profile.groups.id': groupId});
});

publishGroups = function(context) {
    if (context.userId) {
        var user = Meteor.users.findOne({
            _id: context.userId
        });
        if (user.profile.admin === true || user.profile.superAdmin === true) {
            return Groups.find();
        } else {
            return Groups.find({
                leader: context.userId
            });
        }
    } else {
        return [];
    }
};<commit_msg>adapt to new roles package<commit_after>Meteor.publish("groups", function() {
    return publishGroups(this);
});
Meteor.publish("usersInGroup", function(groupId) {
    return Meteor.users.find({'profile.groups.id': groupId});
});

publishGroups = function(context) {
    if (context.userId) {
        var user = Meteor.users.findOne({
            _id: context.userId
        });
        if (Roles.userIsInRole(context.userId, ['admin', 'superAdmin'])) {
            return Groups.find();
        } else {
            return Groups.find({
                leader: context.userId
            });
        }
    } else {
        return [];
    }
};
{'fraction_non_alphanumeric': 0.15011727912431588, 'fraction_numerical': 0.0, 'mean_word_length': 2.1604938271604937, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3673675', 'n_tokens_mistral': 376, 'n_tokens_neox': 365, 'n_words': 67}