当前位置: 首页>>代码示例>>Java>>正文


Java AclEntryScope.ACCESS属性代码示例

本文整理汇总了Java中org.apache.hadoop.fs.permission.AclEntryScope.ACCESS属性的典型用法代码示例。如果您正苦于以下问题:Java AclEntryScope.ACCESS属性的具体用法?Java AclEntryScope.ACCESS怎么用?Java AclEntryScope.ACCESS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.hadoop.fs.permission.AclEntryScope的用法示例。


在下文中一共展示了AclEntryScope.ACCESS属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: check

/**
 * Guarded by {@link FSNamesystem#readLock()}
 */
private void check(String user, Set<String> groups, INode inode,
    int snapshotId, FsAction access) throws AccessControlException {
  if (inode == null) {
    return;
  }
  FsPermission mode = inode.getFsPermission(snapshotId);
  AclFeature aclFeature = inode.getAclFeature(snapshotId);
  if (aclFeature != null) {
    List<AclEntry> featureEntries = aclFeature.getEntries();
    // It's possible that the inode has a default ACL but no access ACL.
    if (featureEntries.get(0).getScope() == AclEntryScope.ACCESS) {
      checkAccessAcl(user, groups, inode, snapshotId, access, mode,
          featureEntries);
      return;
    }
  }
  checkFsPermission(user, groups, inode, snapshotId, access, mode);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:21,代码来源:DefaultAuthorizationProvider.java

示例2: check

/** Guarded by {@link FSNamesystem#readLock()} */
private void check(INode inode, int snapshotId, FsAction access
    ) throws AccessControlException {
  if (inode == null) {
    return;
  }
  FsPermission mode = inode.getFsPermission(snapshotId);
  AclFeature aclFeature = inode.getAclFeature(snapshotId);
  if (aclFeature != null) {
    List<AclEntry> featureEntries = aclFeature.getEntries();
    // It's possible that the inode has a default ACL but no access ACL.
    if (featureEntries.get(0).getScope() == AclEntryScope.ACCESS) {
      checkAccessAcl(inode, snapshotId, access, mode, featureEntries);
      return;
    }
  }
  checkFsPermission(inode, snapshotId, access, mode);
}
 
开发者ID:yncxcw,项目名称:FlexMap,代码行数:18,代码来源:FSPermissionChecker.java

示例3: processOptions

@Override
protected void processOptions(LinkedList<String> args) throws IOException {
  cf.parse(args);
  setRecursive(cf.getOpt("R"));
  // Mix of remove and modify acl flags are not allowed
  boolean bothRemoveOptions = cf.getOpt("b") && cf.getOpt("k");
  boolean bothModifyOptions = cf.getOpt("m") && cf.getOpt("x");
  boolean oneRemoveOption = cf.getOpt("b") || cf.getOpt("k");
  boolean oneModifyOption = cf.getOpt("m") || cf.getOpt("x");
  boolean setOption = cf.getOpt("-set");
  if ((bothRemoveOptions || bothModifyOptions)
      || (oneRemoveOption && oneModifyOption)
      || (setOption && (oneRemoveOption || oneModifyOption))) {
    throw new HadoopIllegalArgumentException(
        "Specified flags contains both remove and modify flags");
  }

  // Only -m, -x and --set expects <acl_spec>
  if (oneModifyOption || setOption) {
    if (args.size() < 2) {
      throw new HadoopIllegalArgumentException("<acl_spec> is missing");
    }
    aclEntries = AclEntry.parseAclSpec(args.removeFirst(), !cf.getOpt("x"));
  }

  if (args.isEmpty()) {
    throw new HadoopIllegalArgumentException("<path> is missing");
  }
  if (args.size() > 1) {
    throw new HadoopIllegalArgumentException("Too many arguments");
  }

  // In recursive mode, save a separate list of just the access ACL entries.
  // Only directories may have a default ACL.  When a recursive operation
  // encounters a file under the specified path, it must pass only the
  // access ACL entries.
  if (isRecursive() && (oneModifyOption || setOption)) {
    accessAclEntries = Lists.newArrayList();
    for (AclEntry entry: aclEntries) {
      if (entry.getScope() == AclEntryScope.ACCESS) {
        accessAclEntries.add(entry);
      }
    }
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:45,代码来源:AclCommands.java

示例4: check

private void check(INodeAttributes inode, String path, FsAction access
    ) throws AccessControlException {
  if (inode == null) {
    return;
  }
  final FsPermission mode = inode.getFsPermission();
  final AclFeature aclFeature = inode.getAclFeature();
  if (aclFeature != null) {
    // It's possible that the inode has a default ACL but no access ACL.
    int firstEntry = aclFeature.getEntryAt(0);
    if (AclEntryStatusFormat.getScope(firstEntry) == AclEntryScope.ACCESS) {
      checkAccessAcl(inode, path, access, mode, aclFeature);
      return;
    }
  }
  if (getUser().equals(inode.getUserName())) { //user class
    if (mode.getUserAction().implies(access)) { return; }
  }
  else if (getGroups().contains(inode.getGroupName())) { //group class
    if (mode.getGroupAction().implies(access)) { return; }
  }
  else { //other class
    if (mode.getOtherAction().implies(access)) { return; }
  }
  throw new AccessControlException(
      toAccessControlString(inode, path, access, mode));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:FSPermissionChecker.java

示例5: processPath

@Override
protected void processPath(PathData item) throws IOException {
  AclStatus aclStatus = item.fs.getAclStatus(item.path);
  out.println("# file: " + item);
  out.println("# owner: " + aclStatus.getOwner());
  out.println("# group: " + aclStatus.getGroup());
  List<AclEntry> entries = aclStatus.getEntries();
  if (aclStatus.isStickyBit()) {
    String stickyFlag = "T";
    for (AclEntry aclEntry : entries) {
      if (aclEntry.getType() == AclEntryType.OTHER
          && aclEntry.getScope() == AclEntryScope.ACCESS
          && aclEntry.getPermission().implies(FsAction.EXECUTE)) {
        stickyFlag = "t";
        break;
      }
    }
    out.println("# flags: --" + stickyFlag);
  }

  FsPermission perm = item.stat.getPermission();
  if (entries.isEmpty()) {
    printMinimalAcl(perm);
  } else {
    printExtendedAcl(perm, entries);
  }

  out.println();
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:29,代码来源:AclCommands.java

示例6: processOptions

@Override
protected void processOptions(LinkedList<String> args) throws IOException {
  cf.parse(args);
  setRecursive(cf.getOpt("R"));
  // Mix of remove and modify acl flags are not allowed
  boolean bothRemoveOptions = cf.getOpt("b") && cf.getOpt("k");
  boolean bothModifyOptions = cf.getOpt("m") && cf.getOpt("x");
  boolean oneRemoveOption = cf.getOpt("b") || cf.getOpt("k");
  boolean oneModifyOption = cf.getOpt("m") || cf.getOpt("x");
  boolean setOption = cf.getOpt("-set");
  boolean hasExpectedOptions = cf.getOpt("b") || cf.getOpt("k") ||
      cf.getOpt("m") || cf.getOpt("x") || cf.getOpt("-set");

  if ((bothRemoveOptions || bothModifyOptions)
      || (oneRemoveOption && oneModifyOption)
      || (setOption && (oneRemoveOption || oneModifyOption))) {
    throw new HadoopIllegalArgumentException(
        "Specified flags contains both remove and modify flags");
  }

  // Only -m, -x and --set expects <acl_spec>
  if (oneModifyOption || setOption) {
    if (args.isEmpty()) {
      throw new HadoopIllegalArgumentException(
          "Missing arguments: <acl_spec> <path>");
    }
    if (args.size() < 2) {
      throw new HadoopIllegalArgumentException(
          "Missing either <acl_spec> or <path>");
    }
    aclEntries = AclEntry.parseAclSpec(args.removeFirst(), !cf.getOpt("x"));
    if (aclEntries.isEmpty()) {
      throw new HadoopIllegalArgumentException(
          "Missing <acl_spec> entry");
    }
  }

  if (args.isEmpty()) {
    throw new HadoopIllegalArgumentException("<path> is missing");
  }
  if (args.size() > 1) {
    throw new HadoopIllegalArgumentException("Too many arguments");
  }

  if (!hasExpectedOptions) {
    throw new HadoopIllegalArgumentException(
        "Expected one of -b, -k, -m, -x or --set options");
  }
  // In recursive mode, save a separate list of just the access ACL entries.
  // Only directories may have a default ACL.  When a recursive operation
  // encounters a file under the specified path, it must pass only the
  // access ACL entries.
  if (isRecursive() && (oneModifyOption || setOption)) {
    accessAclEntries = Lists.newArrayList();
    for (AclEntry entry: aclEntries) {
      if (entry.getScope() == AclEntryScope.ACCESS) {
        accessAclEntries.add(entry);
      }
    }
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:61,代码来源:AclCommands.java


注:本文中的org.apache.hadoop.fs.permission.AclEntryScope.ACCESS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。