NihalJain commented on code in PR #17295:
URL: https://github.com/apache/pinot/pull/17295#discussion_r2578121555


##########
pinot-spi/src/main/java/org/apache/pinot/spi/config/user/UserConfig.java:
##########
@@ -59,26 +61,72 @@ public class UserConfig extends BaseJsonConfig {
     @JsonPropertyDescription("The table permission of User")
     private List<AccessType> _permissions;
 
+    @JsonPropertyDescription("The RLS filters for User per table")
+    private Map<String, List<String>> _rlsFilters;
+
     @JsonCreator
     public UserConfig(@JsonProperty(value = USERNAME_KEY, required = true) 
String username,
         @JsonProperty(value = PASSWORD_KEY, required = true) String password,
         @JsonProperty(value = COMPONET_KEY, required = true) String component,
         @JsonProperty(value = ROLE_KEY, required = true) String role,
         @JsonProperty(value = TABLES_KEY) @Nullable List<String> tableList,
         @JsonProperty(value = EXCLUDE_TABLES_KEY) @Nullable List<String> 
excludeTableList,
-        @JsonProperty(value = PERMISSIONS_KEY) @Nullable List<AccessType> 
permissionList
+        @JsonProperty(value = PERMISSIONS_KEY) @Nullable List<AccessType> 
permissionList,
+        @JsonProperty(value = RLS_FILTERS_KEY) @Nullable Map<String, 
List<String>> rlsFilters
     ) {
-        Preconditions.checkArgument(username != null, "'username' must be 
configured");
-        Preconditions.checkArgument(password != null, "'password' must be 
configured");
+        this(username, password, component, role, tableList, excludeTableList, 
permissionList, rlsFilters, true);
+    }
+
+    /**
+     * Constructor for backward compatibility without RLS filters.
+     * This allows existing code to continue working without modification.
+     */
+    public UserConfig(String username, String password, String component, 
String role,
+        List<String> tableList, List<String> excludeTableList, 
List<AccessType> permissionList) {
+        this(username, password, component, role, tableList, excludeTableList, 
permissionList, null, true);
+    }
+
+    private UserConfig(String username, String password, String component, 
String role,
+        List<String> tableList, List<String> excludeTableList, 
List<AccessType> permissionList,
+        Map<String, List<String>> rlsFilters, boolean validate) {
+        if (validate) {
+            Preconditions.checkArgument(username != null, "'username' must be 
configured");
+            Preconditions.checkArgument(!username.isEmpty(), "'username' must 
not be empty");
+            Preconditions.checkArgument(password != null, "'password' must be 
configured");
+            Preconditions.checkArgument(!password.isEmpty(), "'password' must 
not be empty");
+        }
 
         // NOTE: Handle lower case table type and raw table name for 
backward-compatibility
         _username = username;
         _password = password;
         _componentType = ComponentType.valueOf(component.toUpperCase());
         _roleType = RoleType.valueOf(role.toUpperCase());
+
+        if (tableList != null) {

Review Comment:
   let me do as another commit to keep this pr clean, will revert this change 
here in next commit!



-- 
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]

Reply via email to