use of org.apache.hadoop.fs.permission.FsPermission in project hadoop by apache.
the class TestPermissionSymlinks method testRenameSrcNotWritableFC.
@Test(timeout = 5000)
public void testRenameSrcNotWritableFC() throws Exception {
fs.setPermission(linkParent, new FsPermission((short) 0555));
doRenameSrcNotWritableFC();
}
use of org.apache.hadoop.fs.permission.FsPermission in project hadoop by apache.
the class TestPermissionSymlinks method testReadWhenTargetNotReadable.
@Test(timeout = 5000)
public void testReadWhenTargetNotReadable() throws Exception {
fs.setPermission(target, new FsPermission((short) 0000));
doReadTargetNotReadable();
}
use of org.apache.hadoop.fs.permission.FsPermission in project hadoop by apache.
the class TestPermissionSymlinks method testRenameLinkTargetNotWritableFC.
@Test(timeout = 5000)
public void testRenameLinkTargetNotWritableFC() throws Exception {
fs.setPermission(target, new FsPermission((short) 0555));
fs.setPermission(targetParent, new FsPermission((short) 0555));
doRenameLinkTargetNotWritableFC();
}
use of org.apache.hadoop.fs.permission.FsPermission in project hadoop by apache.
the class ClientNamenodeProtocolTranslatorPB method create.
@Override
public HdfsFileStatus create(String src, FsPermission masked, String clientName, EnumSetWritable<CreateFlag> flag, boolean createParent, short replication, long blockSize, CryptoProtocolVersion[] supportedVersions) throws IOException {
CreateRequestProto.Builder builder = CreateRequestProto.newBuilder().setSrc(src).setMasked(PBHelperClient.convert(masked)).setClientName(clientName).setCreateFlag(PBHelperClient.convertCreateFlag(flag)).setCreateParent(createParent).setReplication(replication).setBlockSize(blockSize);
FsPermission unmasked = masked.getUnmasked();
if (unmasked != null) {
builder.setUnmasked(PBHelperClient.convert(unmasked));
}
builder.addAllCryptoProtocolVersion(PBHelperClient.convert(supportedVersions));
CreateRequestProto req = builder.build();
try {
CreateResponseProto res = rpcProxy.create(null, req);
return res.hasFs() ? PBHelperClient.convert(res.getFs()) : null;
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
use of org.apache.hadoop.fs.permission.FsPermission in project hadoop by apache.
the class FSImageLoader method getAclStatus.
/**
* Return the JSON formatted ACL status of the specified file.
* @param path a path specifies a file
* @return JSON formatted AclStatus
* @throws IOException if failed to serialize fileStatus to JSON.
*/
String getAclStatus(String path) throws IOException {
PermissionStatus p = getPermissionStatus(path);
List<AclEntry> aclEntryList = getAclEntryList(path);
FsPermission permission = p.getPermission();
AclStatus.Builder builder = new AclStatus.Builder();
builder.owner(p.getUserName()).group(p.getGroupName()).addEntries(aclEntryList).setPermission(permission).stickyBit(permission.getStickyBit());
AclStatus aclStatus = builder.build();
return JsonUtil.toJsonString(aclStatus);
}
Aggregations