hdygxsj commented on code in PR #7726:
URL: https://github.com/apache/gravitino/pull/7726#discussion_r2209618609
##########
server-common/src/main/java/org/apache/gravitino/server/authorization/jcasbin/JcasbinAuthorizer.java:
##########
@@ -57,6 +61,8 @@ public class JcasbinAuthorizer implements GravitinoAuthorizer
{
/** Jcasbin enforcer is used for metadata authorization. */
private Enforcer enforcer;
+ private final Set<String> serviceAdmins = Collections.synchronizedSet(new
HashSet<>());
Review Comment:
<img width="732" height="245" alt="image"
src="https://github.com/user-attachments/assets/c982aa7a-77af-480d-88c2-686e39f238ad"
/>
The JDK does not provide a ConcurrentHashSet, and
org.eclipse.jetty.util.ConcurrentHashSet is deprecated. How can we use
ConcurrentHashMap.newKeySet() instead
##########
server/src/main/java/org/apache/gravitino/server/web/rest/MetalakeOperations.java:
##########
@@ -102,6 +124,9 @@ public Response listMetalakes() {
@Produces("application/vnd.gravitino.v1+json")
@Timed(name = "create-metalake." + MetricNames.HTTP_PROCESS_DURATION,
absolute = true)
@ResponseMetered(name = "create-metalake", absolute = true)
+ @AuthorizationExpression(
+ expression = "SERVICE_ADMIN",
+ errorMessage = "Current user can not create metalake.")
Review Comment:
fixed
##########
server/src/main/java/org/apache/gravitino/server/web/rest/CatalogOperations.java:
##########
@@ -103,23 +103,24 @@ public Response listCatalogs(
// Lock the root and the metalake with WRITE lock to ensure the
consistency of the list.
if (verbose) {
Catalog[] catalogs =
catalogDispatcher.listCatalogsInfo(catalogNS);
- Arrays.stream(catalogs)
- .filter(
- catalog -> {
- NameIdentifier[] nameIdentifiers =
- new NameIdentifier[] {
- NameIdentifierUtil.ofCatalog(metalake,
catalog.name())
- };
- return MetadataFilterHelper.filterByExpression(
- metalake,
- loadCatalogAuthorizationExpression,
- Entity.EntityType.CATALOG,
- nameIdentifiers)
- .length
- > 0;
- })
- .collect(Collectors.toList())
- .toArray(new Catalog[0]);
+ catalogs =
Review Comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]