This is an automated email from the ASF dual-hosted git repository.

devesh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 9477aa63fd HDDS-11436. Minor update in Recon API handling. (#7178)
9477aa63fd is described below

commit 9477aa63fd07c6a939b2886d0fb500f07e6f0ea4
Author: Arafat2198 <[email protected]>
AuthorDate: Tue Sep 10 10:51:08 2024 +0530

    HDDS-11436. Minor update in Recon API handling. (#7178)
---
 .../apache/hadoop/ozone/recon/api/TriggerDBSyncEndpoint.java |  1 +
 .../hadoop/ozone/recon/api/filters/TestAdminFilter.java      | 12 ++++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/TriggerDBSyncEndpoint.java
 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/TriggerDBSyncEndpoint.java
index 070b7e1ccd..3ce4fc7f83 100644
--- 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/TriggerDBSyncEndpoint.java
+++ 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/TriggerDBSyncEndpoint.java
@@ -32,6 +32,7 @@ import javax.ws.rs.core.Response;
  */
 @Path("/triggerdbsync")
 @Produces(MediaType.APPLICATION_JSON)
+@AdminOnly
 public class TriggerDBSyncEndpoint {
 
   private OzoneManagerServiceProvider ozoneManagerServiceProvider;
diff --git 
a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/api/filters/TestAdminFilter.java
 
b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/api/filters/TestAdminFilter.java
index e30590df55..7c874a9e29 100644
--- 
a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/api/filters/TestAdminFilter.java
+++ 
b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/api/filters/TestAdminFilter.java
@@ -33,7 +33,6 @@ import org.apache.hadoop.ozone.recon.api.MetricsProxyEndpoint;
 import org.apache.hadoop.ozone.recon.api.NodeEndpoint;
 import org.apache.hadoop.ozone.recon.api.PipelineEndpoint;
 import org.apache.hadoop.ozone.recon.api.TaskStatusService;
-import org.apache.hadoop.ozone.recon.api.TriggerDBSyncEndpoint;
 import org.apache.hadoop.ozone.recon.api.UtilizationEndpoint;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.junit.jupiter.api.Test;
@@ -70,8 +69,14 @@ public class TestAdminFilter {
 
     assertThat(allEndpoints).isNotEmpty();
 
-    // If an endpoint is added, it must be explicitly added to this set or be
-    // marked with @AdminOnly for this test to pass.
+    // If an endpoint is added, it must either require admin privileges by 
being
+    // marked with the `@AdminOnly` annotation, or be added to this set to 
exclude it.
+    // - Any endpoint that displays information related to the filesystem 
namespace
+    //   (including aggregate counts), user information, or allows 
modification to the
+    //   cluster's state should be marked as `@AdminOnly`.
+    // - Read-only endpoints that only return information about node status or
+    //   cluster state do not require the `@AdminOnly` annotation and can be 
excluded
+    //   from admin requirements by adding them to this set.
     Set<Class<?>> nonAdminEndpoints = new HashSet<>();
     nonAdminEndpoints.add(UtilizationEndpoint.class);
     nonAdminEndpoints.add(ClusterStateEndpoint.class);
@@ -79,7 +84,6 @@ public class TestAdminFilter {
     nonAdminEndpoints.add(NodeEndpoint.class);
     nonAdminEndpoints.add(PipelineEndpoint.class);
     nonAdminEndpoints.add(TaskStatusService.class);
-    nonAdminEndpoints.add(TriggerDBSyncEndpoint.class);
 
     assertThat(allEndpoints).containsAll(nonAdminEndpoints);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to