<commit_before>
Meteor.methods({
  'users.profile.update': function(params) {
    if (!Meteor.userId()) {
      throw new Meteor.Error("not-authorized");
    }

    var user = Meteor.users.findOne({ _id: Meteor.userId() });

    params.firstName = params.firstName || user.profile.firstName;
    params.lastName = params.lastName || user.profile.lastName;
    params.photo = params.photo || user.profile.photo;

    Meteor.users.update({ _id: user._id }, {
      $set: {
        "profile.firstName": params.firstName,
        "profile.lastName": params.lastName,
        "profile.photo": params.photo
      }
    });
  }
});<commit_msg>User methods update<commit_after>
Meteor.methods({
  'users.profile.update': function(params) {
    if (!Meteor.userId()) {
      throw new Meteor.Error("not-authorized");
    }

    var user = Meteor.users.findOne({ _id: Meteor.userId() });

    params.firstName = params.firstName || user.profile.firstName;
    params.lastName = params.lastName || user.profile.lastName;
    params.photo = params.photo || user.profile.photo;

    Meteor.users.update({ _id: user._id }, {
      $set: {
        "profile.firstName": params.firstName,
        "profile.lastName": params.lastName,
        "profile.photo": params.photo
      }
    });
  },
  'users.role.set': function(userId, role) {
    if (!Meteor.userId()) {
      throw new Meteor.Error("not-authorized");
    }

    var user = Meteor.user();
    if (!TALCH.user.isAdmin(user)) {
      throw new Meteor.Error("not-authorized");
    }

    var roles = role ? [role] : [];
    Roles.setUserRoles(userId, roles, 'global');
  }
});
{'fraction_non_alphanumeric': 0.1650185414091471, 'fraction_numerical': 0.0, 'mean_word_length': 2.891826923076923, 'pattern_counts': {'":': 6, '<': 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': '4122588', 'n_tokens_mistral': 543, 'n_tokens_neox': 525, 'n_words': 91}