Search in sources :

Example 16 with FsAction

use of org.apache.hadoop.fs.permission.FsAction in project hadoop by apache.

the class FSDownload method checkPublicPermsForAll.

private static boolean checkPublicPermsForAll(FileSystem fs, FileStatus status, FsAction dir, FsAction file) throws IOException {
    FsPermission perms = status.getPermission();
    FsAction otherAction = perms.getOtherAction();
    if (status.isDirectory()) {
        if (!otherAction.implies(dir)) {
            return false;
        }
        for (FileStatus child : fs.listStatus(status.getPath())) {
            if (!checkPublicPermsForAll(fs, child, dir, file)) {
                return false;
            }
        }
        return true;
    }
    return (otherAction.implies(file));
}
Also used : FsAction(org.apache.hadoop.fs.permission.FsAction) FileStatus(org.apache.hadoop.fs.FileStatus) FsPermission(org.apache.hadoop.fs.permission.FsPermission)

Aggregations

FsAction (org.apache.hadoop.fs.permission.FsAction)16 FsPermission (org.apache.hadoop.fs.permission.FsPermission)8 FileStatus (org.apache.hadoop.fs.FileStatus)4 AclEntry (org.apache.hadoop.fs.permission.AclEntry)3 AclEntryType (org.apache.hadoop.fs.permission.AclEntryType)2 AccessControlException (java.security.AccessControlException)1 Configuration (org.apache.hadoop.conf.Configuration)1 AclEntryScope (org.apache.hadoop.fs.permission.AclEntryScope)1 ScopedAclEntries (org.apache.hadoop.fs.permission.ScopedAclEntries)1 AclException (org.apache.hadoop.hdfs.protocol.AclException)1