public static boolean checkAccessPermissions(FileStatus stat, FsAction mode, UserGroupInformation ugi) {
    FsPermission perm = stat.getPermission();
    String user = ugi.getShortUserName();
    List<String> groups = Arrays.asList(ugi.getGroupNames());
    if (user.equals(stat.getOwner())) {
      if (perm.getUserAction().implies(mode)) {
        return true;
      }
    } else if (groups.contains(stat.getGroup())) {
      if (perm.getGroupAction().implies(mode)) {
        return true;
      }
    } else {
      if (perm.getOtherAction().implies(mode)) {
        return true;
      }
    }
    return false;
  }
Converts a Hadoop <code>FileStatus</code> array into a JSON array object.
It replaces the <code>SCHEME://HOST:PORT</code> of the path with the
specified URL.
<p/>

@param status Hadoop file status array.
@return The JSON representation of the file status array.
contrib/views/utils/src/main/java/org/apache/ambari/view/utils/hdfs/HdfsApi.java