mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-18 21:47:39 +02:00
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:
@@ -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;
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user