Returns all databases in catalog cache that match the pattern of 'matcher' and are accessible to 'user'. Callers should handle InconsistentMetadataFetchException when using these dbs.
(PatternMatcher matcher, User user)
| 1518 | * using these dbs. |
| 1519 | */ |
| 1520 | public List<? extends FeDb> getDbs(PatternMatcher matcher, User user) |
| 1521 | throws UserCancelledException, InternalException { |
| 1522 | List<? extends FeDb> dbs = getCatalog().getDbs(matcher); |
| 1523 | |
| 1524 | boolean needsAuthChecks = authzFactory_.getAuthorizationConfig().isEnabled() |
| 1525 | && !userHasAccessForWholeServer(user); |
| 1526 | |
| 1527 | // Filter out the databases the user does not have permissions on. |
| 1528 | if (needsAuthChecks) { |
| 1529 | Iterator<? extends FeDb> iter = dbs.iterator(); |
| 1530 | List<Future<Boolean>> pendingCheckTasks = Lists.newArrayList(); |
| 1531 | while (iter.hasNext()) { |
| 1532 | FeDb db = iter.next(); |
| 1533 | pendingCheckTasks.add(checkAuthorizationPool_.submit( |
| 1534 | new CheckDbAuthorization(db, user))); |
| 1535 | } |
| 1536 | |
| 1537 | filterUnaccessibleElements(pendingCheckTasks, dbs); |
| 1538 | } |
| 1539 | |
| 1540 | return dbs; |
| 1541 | } |
| 1542 | |
| 1543 | /** |
| 1544 | * Returns thrift representation of all databases in catalog cache that match the |
no test coverage detected