Fix created admin users not seeing settings button in sidebar (#503)

The sidebar hid Settings based on hardcoded role === 'user' instead of
the settings:read permission, and login set user state directly from the
response instead of re-fetching full auth status with permissions.
This commit is contained in:
maziggy
2026-02-24 07:52:41 +01:00
parent 04ac6bd36e
commit 974988c4f1
5 changed files with 6 additions and 5 deletions
+2 -2
View File
@@ -220,8 +220,8 @@ export function Layout() {
const result: string[] = [];
const seen = new Set<string>();
// Determine if settings should be hidden (user role and auth enabled)
const hideSettings = authEnabled && user?.role === 'user';
// Determine if settings should be hidden (no settings:read permission)
const hideSettings = authEnabled && !hasPermission('settings:read');
// Add items in stored order
for (const id of sidebarOrder) {
if (hideSettings && id === 'settings') continue;
+1 -1
View File
@@ -95,7 +95,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
const login = async (username: string, password: string) => {
const response = await api.login({ username, password });
setAuthToken(response.access_token);
setUser(response.user);
await checkAuthStatus();
};
const logout = () => {