Skip to content

Commit

Permalink
[feat](authorization)Centralizing Common Authorization Operations in …
Browse files Browse the repository at this point in the history
…a Common Interface

### Optimize Column-Level Permission Checks Using Table-Level Permissions:

Since having column-level permissions does not imply table-level permissions, but having table-level permissions does imply permissions on all columns within the table, we can streamline column permission checks. When checking column-level permissions, we can first check if the user has table-level permissions. If table-level permissions are granted, column-level checks become unnecessary. Only if table-level permissions are absent do we proceed with specific column-level permission checks.

### Global Permissions Shortcut: Global-level permissions typically grant full access across all operations.

Therefore, to optimize permission checks, we can add an early check for global permissions. If the user has global permissions, they are authorized, and further permission checks at the database, table, or column levels are unnecessary, allowing us to return immediately.
  • Loading branch information
CalvinKirs committed Nov 12, 2024
1 parent 448114d commit cb2464a
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,12 @@ public boolean databaseExist(String dbName) {

public List<String> listDatabaseNames() {
try {
preExecutionAuthenticator.execute(() -> {
return nsCatalog.listNamespaces().stream()
.map(Namespace::toString)
.collect(Collectors.toList());

});
return preExecutionAuthenticator.execute(() -> nsCatalog.listNamespaces().stream()
.map(Namespace::toString)
.collect(Collectors.toList()));
} catch (Exception e) {
throw new RuntimeException("Failed to list database names, error message is: " + e.getMessage());
}
return new ArrayList<>();
}


Expand Down

0 comments on commit cb2464a

Please sign in to comment.