public static void checkFileAccess(FileSystem fs, FileStatus stat, FsAction action,
      String user, List<String> groups) throws IOException, AccessControlException {

    if (groups == null) {
      groups = emptyGroups;
    }

    String superGroupName = getSuperGroupName(fs.getConf());
    if (userBelongsToSuperGroup(superGroupName, groups)) {
      LOG.info("User \"" + user + "\" belongs to super-group \"" + superGroupName + "\". " +
          "Permission granted for action: " + action + ".");
      return;
    }

    final FsPermission dirPerms = stat.getPermission();
    final String grp = stat.getGroup();

    if (user.equals(stat.getOwner())) {
      if (dirPerms.getUserAction().implies(action)) {
        return;
      }
    } else if (groups.contains(grp)) {
      if (dirPerms.getGroupAction().implies(action)) {
        return;
      }
    } else if (dirPerms.getOtherAction().implies(action)) {
      return;
    }
    throw new AccessControlException("action " + action + " not permitted on path "
        + stat.getPath() + " for user " + user);
  }
Implements the default file access logic for HadoopShims.checkFileAccess(), for Hadoop
versions which do not implement FileSystem.access().
shims/common/src/main/java/org/apache/hadoop/fs/DefaultFileAccess.java