feat(rbac): hide unauthorized menu sections and enforce route guards
This commit is contained in:
@@ -245,6 +245,23 @@ export const api = {
|
||||
},
|
||||
createTask: (pluginId, params) => postApi('/tasks', { plugin_id: pluginId, params }),
|
||||
|
||||
// Profile
|
||||
getProfilePreferences: () => fetchApi('/profile/preferences'),
|
||||
updateProfilePreferences: (payload) => requestApi('/profile/preferences', 'PATCH', payload),
|
||||
lookupSupersetAccounts: (environmentId, options = {}) => {
|
||||
const normalizedEnvironmentId = String(environmentId || '').trim();
|
||||
if (!normalizedEnvironmentId) {
|
||||
throw new Error('environmentId is required for Superset account lookup');
|
||||
}
|
||||
const params = new URLSearchParams({ environment_id: normalizedEnvironmentId });
|
||||
if (options.search) params.append('search', options.search);
|
||||
if (options.page_index != null) params.append('page_index', String(options.page_index));
|
||||
if (options.page_size != null) params.append('page_size', String(options.page_size));
|
||||
if (options.sort_column) params.append('sort_column', options.sort_column);
|
||||
if (options.sort_order) params.append('sort_order', options.sort_order);
|
||||
return fetchApi(`/profile/superset-accounts?${params.toString()}`);
|
||||
},
|
||||
|
||||
// Settings
|
||||
getSettings: () => fetchApi('/settings'),
|
||||
updateGlobalSettings: (settings) => requestApi('/settings/global', 'PATCH', settings),
|
||||
@@ -268,6 +285,13 @@ export const api = {
|
||||
if (options.search) params.append('search', options.search);
|
||||
if (options.page) params.append('page', options.page);
|
||||
if (options.page_size) params.append('page_size', options.page_size);
|
||||
if (options.page_context) params.append('page_context', options.page_context);
|
||||
if (options.apply_profile_default != null) {
|
||||
params.append('apply_profile_default', String(Boolean(options.apply_profile_default)));
|
||||
}
|
||||
if (options.override_show_all != null) {
|
||||
params.append('override_show_all', String(Boolean(options.override_show_all)));
|
||||
}
|
||||
if (options.filters?.title) {
|
||||
for (const value of options.filters.title) params.append('filter_title', value);
|
||||
}
|
||||
@@ -330,6 +354,9 @@ export const getPlugins = api.getPlugins;
|
||||
export const getTasks = api.getTasks;
|
||||
export const getTask = api.getTask;
|
||||
export const createTask = api.createTask;
|
||||
export const getProfilePreferences = api.getProfilePreferences;
|
||||
export const updateProfilePreferences = api.updateProfilePreferences;
|
||||
export const lookupSupersetAccounts = api.lookupSupersetAccounts;
|
||||
export const getSettings = api.getSettings;
|
||||
export const updateGlobalSettings = api.updateGlobalSettings;
|
||||
export const getEnvironments = api.getEnvironments;
|
||||
|
||||
Reference in New Issue
Block a user