Java Code Examples for org.apache.hadoop.fs.permission.FsAction#or()

The following examples show how to use org.apache.hadoop.fs.permission.FsAction#or() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SentryPermissions.java    From incubator-sentry with Apache License 2.0 6 votes vote down vote up
@Override
public List<AclEntry> getAcls(String authzObj) {
  Map<String, FsAction> groupPerms = getGroupPerms(authzObj);
  List<AclEntry> retList = new LinkedList<AclEntry>();
  for (Map.Entry<String, FsAction> groupPerm : groupPerms.entrySet()) {
    AclEntry.Builder builder = new AclEntry.Builder();
    builder.setName(groupPerm.getKey());
    builder.setType(AclEntryType.GROUP);
    builder.setScope(AclEntryScope.ACCESS);
    FsAction action = groupPerm.getValue();
    if (action == FsAction.READ || action == FsAction.WRITE
        || action == FsAction.READ_WRITE) {
      action = action.or(FsAction.EXECUTE);
    }
    builder.setPermission(action);
    retList.add(builder.build());
  }
  return retList;
}
 
Example 2
Source File: FTPFileSystem.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private FsAction getFsAction(int accessGroup, FTPFile ftpFile) {
  FsAction action = FsAction.NONE;
  if (ftpFile.hasPermission(accessGroup, FTPFile.READ_PERMISSION)) {
    action.or(FsAction.READ);
  }
  if (ftpFile.hasPermission(accessGroup, FTPFile.WRITE_PERMISSION)) {
    action.or(FsAction.WRITE);
  }
  if (ftpFile.hasPermission(accessGroup, FTPFile.EXECUTE_PERMISSION)) {
    action.or(FsAction.EXECUTE);
  }
  return action;
}
 
Example 3
Source File: TestHadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
private static FsAction toFsAction(short mode) {
  FsAction result = FsAction.NONE;

  if ((mode & 0001) != 0) {
    result = result.or(FsAction.EXECUTE);
  }
  if ((mode & 0002) != 0) {
    result = result.or(FsAction.WRITE);
  }
  if ((mode & 0004) != 0) {
    result = result.or(FsAction.READ);
  }
  return result;
}
 
Example 4
Source File: FTPFileSystem.java    From big-c with Apache License 2.0 5 votes vote down vote up
private FsAction getFsAction(int accessGroup, FTPFile ftpFile) {
  FsAction action = FsAction.NONE;
  if (ftpFile.hasPermission(accessGroup, FTPFile.READ_PERMISSION)) {
    action.or(FsAction.READ);
  }
  if (ftpFile.hasPermission(accessGroup, FTPFile.WRITE_PERMISSION)) {
    action.or(FsAction.WRITE);
  }
  if (ftpFile.hasPermission(accessGroup, FTPFile.EXECUTE_PERMISSION)) {
    action.or(FsAction.EXECUTE);
  }
  return action;
}
 
Example 5
Source File: FTPFileSystem.java    From RDFS with Apache License 2.0 5 votes vote down vote up
private FsAction getFsAction(int accessGroup, FTPFile ftpFile) {
  FsAction action = FsAction.NONE;
  if (ftpFile.hasPermission(accessGroup, FTPFile.READ_PERMISSION)) {
    action.or(FsAction.READ);
  }
  if (ftpFile.hasPermission(accessGroup, FTPFile.WRITE_PERMISSION)) {
    action.or(FsAction.WRITE);
  }
  if (ftpFile.hasPermission(accessGroup, FTPFile.EXECUTE_PERMISSION)) {
    action.or(FsAction.EXECUTE);
  }
  return action;
}
 
Example 6
Source File: UpdateableAuthzPermissions.java    From incubator-sentry with Apache License 2.0 5 votes vote down vote up
static FsAction getFAction(String sentryPriv) {
  String[] strPrivs = sentryPriv.trim().split(",");
  FsAction retVal = FsAction.NONE;
  for (String strPriv : strPrivs) {
    retVal = retVal.or(ACTION_MAPPING.get(strPriv.toUpperCase()));
  }
  return retVal;
}
 
Example 7
Source File: FTPFileSystem.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
private FsAction getFsAction(int accessGroup, FTPFile ftpFile) {
  FsAction action = FsAction.NONE;
  if (ftpFile.hasPermission(accessGroup, FTPFile.READ_PERMISSION)) {
    action.or(FsAction.READ);
  }
  if (ftpFile.hasPermission(accessGroup, FTPFile.WRITE_PERMISSION)) {
    action.or(FsAction.WRITE);
  }
  if (ftpFile.hasPermission(accessGroup, FTPFile.EXECUTE_PERMISSION)) {
    action.or(FsAction.EXECUTE);
  }
  return action;
}