drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul-rogers <...@git.apache.org>
Subject [GitHub] drill pull request #983: MD-2769: DRILL-5819: Default value of security.admi...
Date Wed, 11 Oct 2017 04:40:42 GMT
Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/983#discussion_r143910336
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
---
    @@ -75,6 +80,29 @@ public ClusterInfo getClusterInfoJSON() {
         final DrillConfig config = dbContext.getConfig();
         final boolean userEncryptionEnabled = config.getBoolean(ExecConstants.USER_ENCRYPTION_SASL_ENABLED);
         final boolean bitEncryptionEnabled = config.getBoolean(ExecConstants.BIT_ENCRYPTION_SASL_ENABLED);
    +    // If the user is logged in and is admin user then show the admin user info
    +    // For all other cases the user info need-not or should-not be displayed
    +    OptionManager optionManager = work.getContext().getOptionManager();
    +    final boolean isUserLoggedIn = AuthDynamicFeature.isUserLoggedIn(sc);
    +    String adminUsers = isUserLoggedIn ?
    +            ExecConstants.ADMIN_USERS_VALIDATOR.getAdminUsers(optionManager) : null;
    +    String adminUserGroups = isUserLoggedIn ?
    +            ExecConstants.ADMIN_USER_GROUPS_VALIDATOR.getAdminUserGroups(optionManager)
: null;
    +
    +    // separate groups by comma + space
    +    if (adminUsers != null) {
    +      String[] groups = adminUsers.split(",");
    +      adminUsers = DrillStringUtils.join(groups, ", ");
    +    }
    +
    +    // separate groups by comma + space
    +    if (adminUserGroups != null) {
    +      String[] groups = adminUserGroups.split(",");
    +      adminUserGroups = DrillStringUtils.join(groups, ", ");
    --- End diff --
    
    What if the user provided the list with spaces: "a, b,  c"? Actually, in the above, it
is fine; HTML will compress the run of spaces to a single one for display...
    
    But, what about where we do the real check? Do the unit tests cover this case?


---

Mime
View raw message