private static void checkWritePermission(FSPermissionChecker pc, CachePool pool) throws AccessControlException { if ((pc != null)) { pc.checkPermission(pool, FsAction.WRITE); } }
void checkPermission(INodeDirectory inode, int snapshotId, FsAction access) throws AccessControlException { if (dir != null && dir.isPermissionEnabled() && pc != null && !pc.isSuperUser()) { pc.checkPermission(inode, snapshotId, access); } } }
/** * 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(); } } }
if (pc != null) { try { pc.checkPermission(curDirective.getPool(), FsAction.READ); } catch (AccessControlException e) { hasPermission = false;
/** * Returns a CachePoolInfo describing this CachePool based on the permissions * of the calling user. Unprivileged users will see only minimal descriptive * information about the pool. * * @param pc Permission checker to be used to validate the user's permissions, * or null * @return CachePoolEntry describing this CachePool */ public CachePoolEntry getEntry(FSPermissionChecker pc) { boolean hasPermission = true; if (pc != null) { try { pc.checkPermission(this, FsAction.READ); } catch (AccessControlException e) { hasPermission = false; } } return new CachePoolEntry(getInfo(hasPermission), hasPermission ? getStats() : new CachePoolStats.Builder().build()); }
private static void checkWritePermission(FSPermissionChecker pc, CachePool pool) throws AccessControlException { if ((pc != null)) { pc.checkPermission(pool, FsAction.WRITE); } }
private static void checkWritePermission(FSPermissionChecker pc, CachePool pool) throws AccessControlException { if ((pc != null)) { pc.checkPermission(pool, FsAction.WRITE); } }
checkSimpleTraverse(iip); } else { pc.checkPermission(iip, false, null, null, null, null, false);
/** * 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(); } } }
/** * 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(); } } }
readLock(); try { pc.checkPermission(path, inodes, doCheckOwner, ancestorAccess, parentAccess, access, subAccess); } catch (AccessControlException e) {
private void assertPermissionGranted(UserGroupInformation user, String path, FsAction access) throws IOException { INodesInPath iip = dir.getINodesInPath(path, true); dir.getPermissionChecker(SUPERUSER, SUPERGROUP, user).checkPermission(iip, false, null, null, access, null, false); }
private void assertPermissionDenied(UserGroupInformation user, String path, FsAction access) throws IOException { try { INodesInPath iip = dir.getINodesInPath(path, true); dir.getPermissionChecker(SUPERUSER, SUPERGROUP, user).checkPermission(iip, false, null, null, access, null, false); fail("expected AccessControlException for user + " + user + ", path = " + path + ", access = " + access); } catch (AccessControlException e) { assertTrue("Permission denied messages must carry the username", e.getMessage().contains(user.getUserName().toString())); assertTrue("Permission denied messages must carry the path parent", e.getMessage().contains( new Path(path).getParent().toUri().getPath())); } }
if (pc != null) { try { pc.checkPermission(curDirective.getPool(), FsAction.READ); } catch (AccessControlException e) { hasPermission = false;
if (pc != null) { try { pc.checkPermission(curDirective.getPool(), FsAction.READ); } catch (AccessControlException e) { hasPermission = false;
/** * Returns a CachePoolInfo describing this CachePool based on the permissions * of the calling user. Unprivileged users will see only minimal descriptive * information about the pool. * * @param pc Permission checker to be used to validate the user's permissions, * or null * @return CachePoolEntry describing this CachePool */ public CachePoolEntry getEntry(FSPermissionChecker pc) { boolean hasPermission = true; if (pc != null) { try { pc.checkPermission(this, FsAction.READ); } catch (AccessControlException e) { hasPermission = false; } } return new CachePoolEntry(getInfo(hasPermission), hasPermission ? getStats() : new CachePoolStats.Builder().build()); }
/** * Returns a CachePoolInfo describing this CachePool based on the permissions * of the calling user. Unprivileged users will see only minimal descriptive * information about the pool. * * @param pc Permission checker to be used to validate the user's permissions, * or null * @return CachePoolEntry describing this CachePool */ public CachePoolEntry getEntry(FSPermissionChecker pc) { boolean hasPermission = true; if (pc != null) { try { pc.checkPermission(this, FsAction.READ); } catch (AccessControlException e) { hasPermission = false; } } return new CachePoolEntry(getInfo(hasPermission), hasPermission ? getStats() : new CachePoolStats.Builder().build()); }