<commit_before>/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the “License”). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.security.group.provider;

import alluxio.Configuration;
import alluxio.security.group.GroupMappingService;
import alluxio.util.CommonUtils;

import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;

/**
 * A simple shell-based implementation of {@link GroupMappingService} that exec's the {@code groups}
 * shell command to fetch the group memberships of a given user.
 */
public final class ShellBasedUnixGroupsMapping implements GroupMappingService {

  /**
   * Returns list of groups for a user.
   *
   * @param user get groups for this user
   * @return list of groups for a given user
   * @throws IOException when getting the UNIX groups
   */
  @Override
  public List<String> getGroups(String user) throws IOException {
    List<String> groups = CommonUtils.getUnixGroups(user);
    // remove duplicated primary group
    return new ArrayList<String>(new LinkedHashSet<String>(groups));
  }

  @Override
  public void setConf(Configuration conf) {
    // does nothing in this provider of user to groups mapping
  }
}
<commit_msg>[SMALLFIX] Removed explicit parameter types in ShellBasedUnixGroupsMapping<commit_after>/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the “License”). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.security.group.provider;

import alluxio.Configuration;
import alluxio.security.group.GroupMappingService;
import alluxio.util.CommonUtils;

import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;

/**
 * A simple shell-based implementation of {@link GroupMappingService} that exec's the {@code groups}
 * shell command to fetch the group memberships of a given user.
 */
public final class ShellBasedUnixGroupsMapping implements GroupMappingService {

  /**
   * Returns list of groups for a user.
   *
   * @param user get groups for this user
   * @return list of groups for a given user
   * @throws IOException when getting the UNIX groups
   */
  @Override
  public List<String> getGroups(String user) throws IOException {
    List<String> groups = CommonUtils.getUnixGroups(user);
    // remove duplicated primary group
    return new ArrayList<>(new LinkedHashSet<>(groups));
  }

  @Override
  public void setConf(Configuration conf) {
    // does nothing in this provider of user to groups mapping
  }
}

{'fraction_non_alphanumeric': 0.07578947368421053, 'fraction_numerical': 0.002406015037593985, 'mean_word_length': 4.188767550702028, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5400515', 'n_tokens_mistral': 869, 'n_tokens_neox': 857, 'n_words': 368}