<commit_before>Meteor.methods({
    storeEncryptedPrivateKey: function (encryptedKey) {
        Meteor.users.update({
            _id: this.userId
        }, {
            $set: {
                'profile.privateKey': encryptedKey
            }
        });
    },
    initEncryptionSchema: function (collectionName, fieldKey) {
        var schema = {};
        schema[fieldKey] = {
            type: Boolean,
            defaultValue: false
        };
        // add ecrypted field to the collection schema
        Mongo.Collection.get(collectionName).attachSchema(schema);
    }
});

Security.defineMethod("ifCurrentUserIsOwner", {
    fetch: [],
    transform: null,
    deny: function (type, arg, userId, doc) {
        return userId !== doc.ownerId;
    }
});

Principals.permit(['insert']).apply();

Principals.permit(['update', 'remove'])
    .never().apply();

Principals.permit(['update', 'remove'])
    .ifLoggedIn()
    .ifCurrentUserIsOwner()
    .apply();

Meteor.publish("principals", function (dataId) {
    if (dataId) {
        // subscribe to all own principals and the user principal of the partner
        return Principals.find({<commit_msg>Add a missing field to the fetch list of deny rule<commit_after>Meteor.methods({
    storeEncryptedPrivateKey: function (encryptedKey) {
        Meteor.users.update({
            _id: this.userId
        }, {
            $set: {
                'profile.privateKey': encryptedKey
            }
        });
    },
    initEncryptionSchema: function (collectionName, fieldKey) {
        var schema = {};
        schema[fieldKey] = {
            type: Boolean,
            defaultValue: false
        };
        // add ecrypted field to the collection schema
        Mongo.Collection.get(collectionName).attachSchema(schema);
    }
});

Security.defineMethod("ifCurrentUserIsOwner", {
    fetch: ['ownerId'],
    transform: null,
    deny: function (type, arg, userId, doc) {
        return userId !== doc.ownerId;
    }
});

Principals.permit(['insert']).apply();

Principals.permit(['update', 'remove'])
    .never().apply();

Principals.permit(['update', 'remove'])
    .ifLoggedIn()
    .ifCurrentUserIsOwner()
    .apply();

Meteor.publish("principals", function (dataId) {
    if (dataId) {
        // subscribe to all own principals and the user principal of the partner
        return Principals.find({
{'fraction_non_alphanumeric': 0.13260135135135134, 'fraction_numerical': 0.0, 'mean_word_length': 2.428364688856729, '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': '4243261', 'n_tokens_mistral': 684, 'n_tokens_neox': 679, 'n_words': 150}