roles are now better
This commit is contained in:
@@ -26,6 +26,7 @@ use canvas::DataProvider;
|
||||
use crate::state::app::state::AppState;
|
||||
use crate::pages::admin::AdminState;
|
||||
use crate::state::pages::auth::AuthState;
|
||||
use crate::state::pages::auth::UserRole;
|
||||
use crate::pages::login::LoginState;
|
||||
use crate::pages::register::RegisterState;
|
||||
use crate::pages::intro::IntroState;
|
||||
@@ -528,7 +529,7 @@ impl EventHandler {
|
||||
}
|
||||
}
|
||||
Page::Admin(state) => {
|
||||
if auth_state.role.as_deref() == Some("admin") {
|
||||
if matches!(auth_state.role, Some(UserRole::Admin)) {
|
||||
if state.handle_movement(app_state, ma) {
|
||||
return Ok(EventOutcome::Ok(String::new()));
|
||||
}
|
||||
@@ -545,7 +546,7 @@ impl EventHandler {
|
||||
|
||||
// Optional page-specific handlers (non-movement or rich actions)
|
||||
if let Page::Admin(admin_state) = &mut router.current {
|
||||
if auth_state.role.as_deref() == Some("admin") {
|
||||
if matches!(auth_state.role, Some(UserRole::Admin)) {
|
||||
// Full admin navigation
|
||||
if handle_admin_navigation(
|
||||
key_event,
|
||||
@@ -961,7 +962,7 @@ impl EventHandler {
|
||||
"exit_highlight_mode" |
|
||||
"save" |
|
||||
"quit" |
|
||||
"force_quit" |
|
||||
"Force_quit" |
|
||||
"save_and_quit" |
|
||||
"revert" |
|
||||
"enter_decider" |
|
||||
|
||||
Reference in New Issue
Block a user