Tabnine Logo
FSPermissionChecker
Code IndexAdd Tabnine to your IDE (free)

How to use
FSPermissionChecker
in
org.apache.hadoop.hdfs.server.namenode

Best Java code snippets using org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker (Showing top 20 results out of 315)

origin: org.apache.hadoop/hadoop-hdfs

private static void checkWritePermission(FSPermissionChecker pc,
  CachePool pool) throws AccessControlException {
 if ((pc != null)) {
  pc.checkPermission(pool, FsAction.WRITE);
 }
}
origin: org.apache.hadoop/hadoop-hdfs

@VisibleForTesting
FSPermissionChecker getPermissionChecker(String fsOwner, String superGroup,
  UserGroupInformation ugi) throws AccessControlException {
 return new FSPermissionChecker(
   fsOwner, superGroup, ugi, getUserFilteredAttributeProvider(ugi));
}
origin: org.apache.hadoop/hadoop-hdfs

 checkTraverse(inodeAttrs, inodes, components, ancestorIndex);
} catch (UnresolvedPathException | ParentNotDirectoryException ex) {
if (parentAccess != null && parentAccess.implies(FsAction.WRITE)
  && inodeAttrs.length > 1 && last != null) {
 checkStickyBit(inodeAttrs, components, inodeAttrs.length - 2);
 check(inodeAttrs, components, ancestorIndex, ancestorAccess);
 check(inodeAttrs, components, inodeAttrs.length - 2, parentAccess);
 check(inodeAttrs, components, inodeAttrs.length - 1, access);
 checkSubAccess(components, inodeAttrs.length - 1, rawLast,
   snapshotId, subAccess, ignoreEmptyDir);
 checkOwner(inodeAttrs, components, inodeAttrs.length - 1);
origin: org.apache.hadoop/hadoop-hdfs

/** Guarded by {@link FSNamesystem#readLock()}
 * @throws AccessControlException
 * @throws ParentNotDirectoryException
 * @throws UnresolvedPathException
 */
private void checkTraverse(INodeAttributes[] inodeAttrs, INode[] inodes,
  byte[][] components, int last) throws AccessControlException,
    UnresolvedPathException, ParentNotDirectoryException {
 for (int i=0; i <= last; i++) {
  checkIsDirectory(inodes[i], components, i);
  check(inodeAttrs, components, i, FsAction.EXECUTE);
 }
}
origin: org.apache.hadoop/hadoop-hdfs

 void checkPermission(INodeDirectory inode, int snapshotId, FsAction access)
   throws AccessControlException {
  if (dir != null && dir.isPermissionEnabled()
    && pc != null && !pc.isSuperUser()) {
   pc.checkPermission(inode, snapshotId, access);
  }
 }
}
origin: org.apache.hadoop/hadoop-hdfs

void checkSuperuserPrivilege(FSPermissionChecker pc)
  throws AccessControlException {
 if (isPermissionEnabled) {
  pc.checkSuperuserPrivilege();
 }
}
origin: org.apache.hadoop/hadoop-hdfs

   UnresolvedPathException, ParentNotDirectoryException {
try {
 if (pc == null || pc.isSuperUser()) {
  checkSimpleTraverse(iip);
 } else {
  pc.checkPermission(iip, false, null, null, null, null, false);
 checkNotSymlink(iip.getINode(last), iip.getPathComponents(), last);
origin: org.apache.hadoop/hadoop-hdfs

final byte[][] components = inodesInPath.getPathComponents();
for (int i = 0; i < inodes.length && inodes[i] != null; i++) {
 inodeAttrs[i] = getINodeAttrs(components, i, inodes[i], snapshotId);
int ancestorIndex = inodes.length - 2;
AccessControlEnforcer enforcer = getAccessControlEnforcer();
enforcer.checkPermission(fsOwner, supergroup, callerUgi, inodeAttrs, inodes,
  components, snapshotId, path, ancestorIndex, doCheckOwner,
origin: com.facebook.hadoop/hadoop-core

throws AccessControlException {
boolean permissionCheckFailed = false;
FSPermissionChecker pc = new FSPermissionChecker(
 fsOwner.getUserName(), supergroup);
if (!pc.isSuper) {
 readLock();
 try {
  pc.checkPermission(path, inodes, doCheckOwner,
   ancestorAccess, parentAccess, access, subAccess);
 } catch (AccessControlException e) {
origin: com.facebook.hadoop/hadoop-core

private void checkTraverse(INode[] inodes, int last
  ) throws AccessControlException {
 for(int j = 0; j <= last; j++) {
  check(inodes[j], FsAction.EXECUTE);
 }
}
origin: org.apache.hadoop/hadoop-hdfs

 byte[][] localComponents = {inode.getLocalNameBytes()};
 INodeAttributes[] iNodeAttr = {inode.getSnapshotINode(snapshotId)};
 AccessControlEnforcer enforcer = getAccessControlEnforcer();
 enforcer.checkPermission(
   fsOwner, supergroup, callerUgi,
} catch (AccessControlException ace) {
 throw new AccessControlException(
   toAccessControlString(inode, inode.getFullPathName(), access));
origin: org.apache.hadoop/hadoop-hdfs

void checkTraverse(FSPermissionChecker pc, INodesInPath iip,
  boolean resolveLink) throws AccessControlException,
   UnresolvedPathException, ParentNotDirectoryException {
 FSPermissionChecker.checkTraverse(
   isPermissionEnabled ? pc : null, iip, resolveLink);
}
origin: org.apache.hadoop/hadoop-hdfs

private INodeAttributes getINodeAttrs(byte[][] pathByNameArr, int pathIdx,
  INode inode, int snapshotId) {
 INodeAttributes inodeAttrs = inode.getSnapshotINode(snapshotId);
 if (getAttributesProvider() != null) {
  String[] elements = new String[pathIdx + 1];
  /**
   * {@link INode#getPathComponents(String)} returns a null component
   * for the root only path "/". Assign an empty string if so.
   */
  if (pathByNameArr.length == 1 && pathByNameArr[0] == null) {
   elements[0] = "";
  } else {
   for (int i = 0; i < elements.length; i++) {
    elements[i] = DFSUtil.bytes2String(pathByNameArr[i]);
   }
  }
  inodeAttrs = getAttributesProvider().getAttributes(elements, inodeAttrs);
 }
 return inodeAttrs;
}
origin: org.apache.hadoop/hadoop-hdfs

/**
 * Check whether current user have permissions to access the path. For more
 * details of the parameters, see
 * {@link FSPermissionChecker#checkPermission}.
 */
void checkPermission(FSPermissionChecker pc, INodesInPath iip,
  boolean doCheckOwner, FsAction ancestorAccess, FsAction parentAccess,
  FsAction access, FsAction subAccess, boolean ignoreEmptyDir)
  throws AccessControlException {
 if (!pc.isSuperUser()) {
  readLock();
  try {
   pc.checkPermission(iip, doCheckOwner, ancestorAccess,
     parentAccess, access, subAccess, ignoreEmptyDir);
  } finally {
   readUnlock();
  }
 }
}
origin: org.apache.hadoop/hadoop-hdfs

void checkSuperuserPrivilege() throws AccessControlException {
 if (isPermissionEnabled) {
  FSPermissionChecker pc = getPermissionChecker();
  pc.checkSuperuserPrivilege();
 }
}
origin: ch.cern.hadoop/hadoop-hdfs

final byte[][] components = inodesInPath.getPathComponents();
for (int i = 0; i < inodes.length && inodes[i] != null; i++) {
 inodeAttrs[i] = getINodeAttrs(components, i, inodes[i], snapshotId);
int ancestorIndex = inodes.length - 2;
AccessControlEnforcer enforcer = getAccessControlEnforcer();
enforcer.checkPermission(fsOwner, supergroup, callerUgi, inodeAttrs, inodes,
  components, snapshotId, path, ancestorIndex, doCheckOwner,
origin: com.facebook.hadoop/hadoop-core

private void check(INode[] inodes, int i, FsAction access
  ) throws AccessControlException {
 check(i >= 0? inodes[i]: null, access);
}
origin: io.prestosql.hadoop/hadoop-apache

private INodeAttributes getINodeAttrs(byte[][] pathByNameArr, int pathIdx,
  INode inode, int snapshotId) {
 INodeAttributes inodeAttrs = inode.getSnapshotINode(snapshotId);
 if (getAttributesProvider() != null) {
  String[] elements = new String[pathIdx + 1];
  for (int i = 0; i < elements.length; i++) {
   elements[i] = DFSUtil.bytes2String(pathByNameArr[i]);
  }
  inodeAttrs = getAttributesProvider().getAttributes(elements, inodeAttrs);
 }
 return inodeAttrs;
}
origin: ch.cern.hadoop/hadoop-hdfs

  ancestorIndex--);
checkTraverse(inodeAttrs, ancestorIndex);
 checkStickyBit(inodeAttrs, inodeAttrs.length - 2);
 check(inodeAttrs, ancestorIndex, ancestorAccess);
 check(inodeAttrs, inodeAttrs.length - 2, parentAccess);
 check(inodeAttrs, inodeAttrs.length - 1, access);
 checkSubAccess(components, inodeAttrs.length - 1, rawLast,
   snapshotId, subAccess, ignoreEmptyDir);
 checkOwner(inodeAttrs, inodeAttrs.length - 1);
origin: org.apache.hadoop/hadoop-hdfs

if (pc != null) {
 try {
  pc.checkPermission(curDirective.getPool(), FsAction.READ);
 } catch (AccessControlException e) {
  hasPermission = false;
org.apache.hadoop.hdfs.server.namenodeFSPermissionChecker

Javadoc

Class that helps in checking file system permission. The state of this class need not be synchronized as it has data structures that are read-only. Some of the helper methods are gaurded by FSNamesystem#readLock().

Most used methods

  • checkPermission
    Check whether current user have permissions to access the path. Traverse is always checked. Parent p
  • <init>
  • check
    Guarded by FSNamesystem#readLock()
  • checkOwner
    Guarded by FSNamesystem#readLock()
  • checkSubAccess
    Guarded by FSNamesystem#readLock()
  • checkTraverse
    Guarded by FSNamesystem#readLock()
  • checkStickyBit
    Guarded by FSNamesystem#readLock()
  • checkSuperuserPrivilege
    Verify if the caller has the required permission. This will result into an exception if the caller i
  • getAccessControlEnforcer
  • getAttributesProvider
  • getINodeAttrs
  • getUser
  • getINodeAttrs,
  • getUser,
  • hasAclPermission,
  • hasPermission,
  • isSuperUser,
  • toAccessControlString,
  • constructPath,
  • containsGroup,
  • isMemberOfGroup,
  • checkIsDirectory

Popular in Java

  • Updating database using SQL prepared statement
  • compareTo (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • setScale (BigDecimal)
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now