String fileOwner = fs.getOwner();
String fileGroup = fs.getGroup();
FsPermission fsp = fs.getPermissions();
// Check world-readable
FsAction otherAction = fsp.getOtherAction();
if (otherAction == FsAction.ALL ||
otherAction == FsAction.READ ||
otherAction == FsAction.READ_EXECUTE ||
otherAction == FsAction.READ_WRITE) {
return true;
}
// Check group-readable
// REMIND -- mjc -- implement group-readable testing when we have the user database
// that will tell us the current logged-in-user's groups.
// Check owner-readable
if (currentUser != null && currentUser.equals(fileOwner)) {
FsAction userAction = fsp.getUserAction();
if (userAction == FsAction.ALL ||
userAction == FsAction.READ ||
userAction == FsAction.READ_EXECUTE ||
userAction == FsAction.READ_WRITE) {
return true;