<commit_before>Meteor.methods({
  updateUserRoles: function(userId, isAdmin, isCreator) {
    if (checkPermissions()) {
      if (isAdmin) {
        Roles.addUsersToRoles(userId, 'bofh');
      } else {
        Roles.removeUsersFromRoles(userId, 'bofh');
      }
      if (isCreator) {
        Roles.addUsersToRoles(userId, 'job-creator');
      } else {
        Roles.removeUsersFromRoles(userId, 'job-creator');
      }
    } else {
      //FIXME Should log an error for the admins
      console.log("User '" + this.userId + "' does not have permissions");
    }
  },
  deleteUser: function(userId) {
    if (checkPermissions()) {
      Meteor.users.remove({_id: userId});
    } else {
      //FIXME Should log an error for the admins
      console.log("User '" + this.userId + "' does not have permissions");
    }
  }
});

var checkPermissions = function() {
  if (Roles.userIsInRole(Meteor.user(), 'bofh')) {
    return true;
  } else {
    return false;
  }
};<commit_msg>Added some logging.<commit_after>var debug = Npm.require("debug")("loki:collections:users:validation");

Meteor.methods({
  updateUserRoles: function(userId, isAdmin, isCreator) {
    if (checkPermissions()) {
      if (isAdmin) {
        Roles.addUsersToRoles(userId, 'bofh');
      } else {
        Roles.removeUsersFromRoles(userId, 'bofh');
      }
      if (isCreator) {
        Roles.addUsersToRoles(userId, 'job-creator');
      } else {
        Roles.removeUsersFromRoles(userId, 'job-creator');
      }
    } else {
      //FIXME Should log an error for the admins
      debug("User %j does not have permissions", this.userId);
    }
  },
  deleteUser: function(userId) {
    if (checkPermissions()) {
      Meteor.users.remove({_id: userId});
    } else {
      //FIXME Should log an error for the admins
      debug("User %j does not have permissions", this.userId);
    }
  }
});

var checkPermissions = function() {
  if (Roles.userIsInRole(Meteor.user(), 'bofh')) {
    return true;
  } else {
    return false;
  }
};
{'fraction_non_alphanumeric': 0.1427860696517413, 'fraction_numerical': 0.0, 'mean_word_length': 2.751865671641791, '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': '6310377', 'n_tokens_mistral': 664, 'n_tokens_neox': 681, 'n_words': 143}