<commit_before>const _ = require('lodash');
const utils = require('../../../schema/fixtures/utils');
const permissions = require('../../../../services/permissions');
const common = require('../../../../lib/common');
const resource = 'members';
const _private = {};

_private.getPermissions = function getPermissions() {
    return utils.findModelFixtures('Permission', {object_type: resource});
};

_private.getRelations = function getRelations() {
    return utils.findPermissionRelationsForObject(resource);
};

_private.printResult = function printResult(result, message) {
    if (result.done === result.expected) {
        common.logging.info(message);
    } else {
        common.logging.warn('(' + result.done + '/' + result.expected + ') ' + message);
    }
};

module.exports.up = function addMembersPermissions(options) {
    const modelToAdd = _private.getPermissions();
    const relationToAdd = _private.getRelations();
    const localOptions = _.merge({
        context: {
            internal: true,
            migrating: true
        }
    }, options);

    return utils.addFixturesForModel(modelToAdd, localOptions)
        .then(function (result) {
            _private.printResult(result, 'Adding permissions fixtures for ' + resource + 's');
            return utils.addFixturesForRelation(relationToAdd, localOptions);
        })
        .then(function (result) {
            _private.printResult(result, 'Adding permissions_roles fixtures for ' + resource + 's');
            return permissions.init(localOptions);
        });
};<commit_msg>Removed 2.16 member permission migration<commit_after>module.exports.up = module.exports.down = () => Promise.resolve();
{'fraction_non_alphanumeric': 0.14548693586698339, 'fraction_numerical': 0.0017814726840855108, 'mean_word_length': 3.2766497461928936, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '1794225', 'n_tokens_mistral': 451, 'n_tokens_neox': 448, 'n_words': 92}