fix issues

This commit is contained in:
2026-01-01 16:32:06 +01:00
parent aee182b09e
commit 17d715f259
19 changed files with 1014 additions and 344 deletions

View File

@@ -32,19 +32,14 @@ export class AuthorizationBlocker extends Blocker {
this.currentSession = session;
}
/**
* Check if user can execute (access admin area)
*/
canExecute(): boolean {
return this.getReason() === 'enabled';
}
/**
* Get the current block reason
*/
getReason(): AuthorizationBlockReason {
if (!this.currentSession) {
return 'loading';
// Session is null - this means unauthenticated (not loading)
// Loading state is handled by AuthContext
return 'unauthenticated';
}
if (!this.currentSession.isAuthenticated) {
@@ -66,6 +61,14 @@ export class AuthorizationBlocker extends Blocker {
return 'enabled'; // Allow access for demo purposes
}
/**
* Check if user can execute (access admin area)
*/
canExecute(): boolean {
const reason = this.getReason();
return reason === 'enabled';
}
/**
* Block access (for testing/demo purposes)
*/
@@ -88,14 +91,12 @@ export class AuthorizationBlocker extends Blocker {
const reason = this.getReason();
switch (reason) {
case 'loading':
return 'Loading user data...';
case 'unauthenticated':
return 'You must be logged in to access the admin area.';
return 'You must be logged in to access this area.';
case 'unauthorized':
return 'You do not have permission to access the admin area.';
return 'You do not have permission to access this area.';
case 'insufficient_role':
return `Admin access requires one of: ${this.requiredRoles.join(', ')}`;
return `Access requires one of: ${this.requiredRoles.join(', ')}`;
case 'enabled':
return 'Access granted';
default: