devabhishekpal commented on code in PR #7268:
URL: https://github.com/apache/ozone/pull/7268#discussion_r1814600775
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/OzoneAdmins.java:
##########
@@ -186,4 +191,85 @@ public static Collection<String>
getOzoneReadOnlyAdminsGroupsFromConfig(
return conf.getTrimmedStringCollection(
OZONE_READONLY_ADMINISTRATORS_GROUPS);
}
+
+ /**
+ * Get the list of S3 administrators from Ozone config.
+ *
+ * @param conf An instance of {@link OzoneConfiguration} being used
+ * @return A {@link Collection} of the S3 administrator users
+ *
+ * If ozone.s3.administrators value is empty string or unset,
+ * defaults to ozone.administrators value.
+ */
+ public static Collection<String> getS3AdminsFromConfig(OzoneConfiguration
conf) throws IOException {
+ Collection<String> ozoneAdmins =
conf.getTrimmedStringCollection(OZONE_S3_ADMINISTRATORS);
+
+ if (ozoneAdmins == null || ozoneAdmins.isEmpty()) {
+ ozoneAdmins = conf.getTrimmedStringCollection(OZONE_ADMINISTRATORS);
+ }
+ String omSPN = UserGroupInformation.getCurrentUser().getShortUserName();
+ if (!ozoneAdmins.contains(omSPN)) {
+ ozoneAdmins.add(omSPN);
+ }
+
+ return ozoneAdmins;
+ }
+
+ /**
+ * Get the list of the groups that are a part S3 administrators from Ozone
config.
+ *
+ * @param conf An instance of {@link OzoneConfiguration} being used
+ * @return A {@link Collection} of the S3 administrator groups
+ *
+ * If ozone.s3.administrators.groups value is empty or unset,
+ * defaults to the ozone.administrators.groups value
+ */
+ public static Collection<String>
getS3AdminsGroupsFromConfig(OzoneConfiguration conf) {
+ Collection<String> s3AdminsGroup =
conf.getTrimmedStringCollection(OZONE_S3_ADMINISTRATORS_GROUPS);
+
+ if (s3AdminsGroup.isEmpty() &&
conf.getTrimmedStringCollection(OZONE_S3_ADMINISTRATORS).isEmpty()) {
+ s3AdminsGroup =
conf.getTrimmedStringCollection(OZONE_ADMINISTRATORS_GROUPS);
+ }
+
+ return s3AdminsGroup;
+ }
+
+ /**
+ * Get the users and groups that are a part of S3 administrators.
+ * @param conf Stores an instance of {@link OzoneConfiguration} being used
+ * @return an instance of {@link OzoneAdmins} containing the S3 admin users
and groups
+ */
+ public static OzoneAdmins getS3Admins(OzoneConfiguration conf) {
+ Collection<String> s3Admins;
Review Comment:
Addressed in
[9e8c64e](https://github.com/apache/ozone/pull/7268/commits/9e8c64e08e7b902e8a7331d5654c877ad43b97e4)
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/OzoneAdmins.java:
##########
@@ -186,4 +191,85 @@ public static Collection<String>
getOzoneReadOnlyAdminsGroupsFromConfig(
return conf.getTrimmedStringCollection(
OZONE_READONLY_ADMINISTRATORS_GROUPS);
}
+
+ /**
+ * Get the list of S3 administrators from Ozone config.
+ *
+ * @param conf An instance of {@link OzoneConfiguration} being used
+ * @return A {@link Collection} of the S3 administrator users
+ *
+ * If ozone.s3.administrators value is empty string or unset,
+ * defaults to ozone.administrators value.
+ */
+ public static Collection<String> getS3AdminsFromConfig(OzoneConfiguration
conf) throws IOException {
Review Comment:
Addressed in
[9e8c64e](https://github.com/apache/ozone/pull/7268/commits/9e8c64e08e7b902e8a7331d5654c877ad43b97e4)
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]