Open hanslemm opened 5 months ago
To resolve the issue where the dataset drop-down in the RLS rule creation pop-up in Superset does not show all available datasets unless a role is selected first, ensure that the AsyncSelect
component for datasets is properly configured to load options independently of the role selection.
Check the loadTableOptions
function to ensure it correctly fetches the dataset options:
const loadTableOptions = useMemo(
() =>
(input = '', page: number, pageSize: number) => {
const query = rison.encode({
filter: input,
page,
page_size: pageSize,
});
return SupersetClient.get({
endpoint: `/api/v1/rowlevelsecurity/related/tables?q=${query}`,
}).then(response => {
const list = response.json.result.map(
(item: { value: number; text: string }) => ({
label: item.text,
value: item.value,
}),
);
return { data: list, totalCount: response.json.count };
});
},
[],
);
<AsyncSelect
ariaLabel={t('Tables')}
mode="multiple"
onChange={onTablesChange}
value={(currentRule?.tables as SelectValue[]) || []}
options={loadTableOptions}
/>
Ensure that loadTableOptions
is fetching and returning the dataset options independently of the role selection.
Additionally, verify that the RowLevelSecurityModal
component is correctly set up to fetch related tables and roles independently. The endpoints for fetching related tables and roles should be correctly implemented and tested:
const getRelatedTablesEndpoint =
'glob:*/api/v1/rowlevelsecurity/related/tables?q*';
const getRelatedRolesEndpoint =
'glob:*/api/v1/rowlevelsecurity/related/roles?q*';
fetchMock.get(getRelatedTablesEndpoint, mockGetTablesResult);
fetchMock.get(getRelatedRolesEndpoint, mockGetRolesResult);
User permissions or RBAC configurations might also influence the visibility of datasets. Ensure that the API endpoints respect the user's permissions and roles.
Recent changes in the superset-frontend
repository might also affect the behavior of the dataset drop-down. Relevant pull requests include:
These updates might impact the dataset drop-down behavior in the RLS rule creation pop-up.
To continue the conversation, mention @dosu.
Bug description
When trying to create a new RLS rule, in the rule pop-up (check image for reference), there is the drop-down field for datasets. If you start filling this pop-up through the dataset field (which would be natural since this the obligatory field), in my version of Superset (and since 3.0.0 tbh I already detected this), not all datasets registered in Superset are available in the drop-down menu. Yet, if you rather start filling this pop-up through the role drop-down, then all the datasets will be visible.
How to reproduce the bug
Preconditions: have RBAC enabled in your Superset config.
Screenshots/recordings
No response
Superset version
4.0.1
Python version
3.10
Node version
I don't know
Browser
Chrome
Additional context
No response
Checklist