List of usage examples for org.apache.hadoop.fs.permission AclEntryScope DEFAULT
AclEntryScope DEFAULT
To view the source code for org.apache.hadoop.fs.permission AclEntryScope DEFAULT.
Click Source Link
From source file:alluxio.underfs.hdfs.acl.SupportedHdfsAclProvider.java
License:Apache License
private AclEntry getHdfsAclEntry(alluxio.security.authorization.AclEntry entry) throws IOException { AclEntry.Builder builder = new AclEntry.Builder(); // Do not set name for unnamed entries if (entry.getType() != alluxio.security.authorization.AclEntryType.OWNING_USER && entry.getType() != alluxio.security.authorization.AclEntryType.OWNING_GROUP) { builder.setName(entry.getSubject()); }//from ww w. j av a 2 s. c o m builder.setScope(entry.isDefault() ? AclEntryScope.DEFAULT : AclEntryScope.ACCESS); builder.setType(getHdfsAclEntryType(entry)); FsAction permission = FsAction.getFsAction(entry.getActions().toCliString()); builder.setPermission(permission); return builder.build(); }
From source file:org.trustedanalytics.auth.gateway.hdfs.HdfsClient.java
License:Apache License
/** * Modify acl for directory or file. File that include ACL with scope Default will be ignored * /*from w w w. ja v a 2s.c o m*/ * @param path File or Directory path on Hdfs. * @param aclEntries List of Entries, each entry represents one ACL. * @throws IOException */ public void modifyAcl(Path path, List<AclEntry> aclEntries) throws IOException { if (fileSystem.isDirectory(path)) { fileSystem.modifyAclEntries(path, aclEntries); } else { fileSystem.modifyAclEntries(path, aclEntries.stream() .filter(acl -> acl.getScope() != AclEntryScope.DEFAULT).collect(Collectors.toList())); } }
From source file:org.trustedanalytics.samples.utils.FsPermissionHelper.java
License:Apache License
public static List<AclEntry> getDefaultAclsForTechnicalUsers(List<String> users, FsAction fsAction) { List<AclEntry> acls = users.stream() .map(name -> getAcl(AclEntryScope.DEFAULT, fsAction, AclEntryType.USER, name)).collect(toList()); acls.add(getAcl(AclEntryScope.DEFAULT, FsAction.ALL, AclEntryType.GROUP)); acls.add(getAcl(AclEntryScope.DEFAULT, FsAction.ALL, AclEntryType.MASK)); return acls;/*from w w w . ja va2 s.co m*/ }
From source file:org.trustedanalytics.servicebroker.hdfs.plans.provisioning.HdfsProvisioningClient.java
License:Apache License
@Override public void addTapUserAcl(String path, String orgId) throws ServiceBrokerException { try {// w ww .jav a 2s .c o m AclEntry.Builder builder = new AclEntry.Builder().setType(AclEntryType.USER).setPermission(FsAction.ALL) .setName("tap"); AclEntry tapDefaultUserAcl = builder.setScope(AclEntryScope.DEFAULT).build(); AclEntry tapUserAcl = builder.setScope(AclEntryScope.ACCESS).build(); setAclRecursively(path, tapUserAcl); setAclRecursively(path, tapDefaultUserAcl); } catch (IOException e) { throw new ServiceBrokerException("Unable to add system users groups ACL for path: " + path, e); } }
From source file:org.trustedanalytics.servicebroker.hdfs.plans.provisioning.HdfsProvisioningClient.java
License:Apache License
@Override public void addHiveUserGroupAcl(String path, String orgId) throws ServiceBrokerException { try {// w ww . jav a2 s.c o m AclEntry.Builder builder = new AclEntry.Builder().setType(AclEntryType.GROUP) .setPermission(FsAction.ALL).setName("hive"); AclEntry hiveDefaultUserAcl = builder.setScope(AclEntryScope.DEFAULT).build(); AclEntry hiveUserAcl = builder.setScope(AclEntryScope.ACCESS).build(); setAclRecursively(path, hiveUserAcl); setAclRecursively(path, hiveDefaultUserAcl); } catch (IOException e) { throw new ServiceBrokerException("Unable to add system users groups ACL for path: " + path, e); } }
From source file:org.trustedanalytics.servicebroker.hdfs.plans.provisioning.HdfsProvisioningClient.java
License:Apache License
private void setAclRecursively(String path, AclEntry acl) throws IOException { superUserHdfsClient.addAclEntry(path, acl); for (String file : superUserHdfsClient.listFiles(path, true)) { if (superUserHdfsClient.isDirectory(file) || !acl.getScope().equals(AclEntryScope.DEFAULT)) superUserHdfsClient.addAclEntry(file, acl); }/*from w w w .j a va2 s. c o m*/ }
From source file:org.trustedanalytics.servicebroker.hdfs.util.TestUtil.java
License:Apache License
public static AclEntry defaultUserAcl(String user) { return build(user).setScope(AclEntryScope.DEFAULT).build(); }