website refactor
This commit is contained in:
@@ -263,13 +263,13 @@ export const routeMatchers = {
|
||||
* Check if path is public
|
||||
*/
|
||||
isPublic(path: string): boolean {
|
||||
logger.info('[RouteConfig] isPublic check', { path });
|
||||
// logger.info('[RouteConfig] isPublic check', { path });
|
||||
|
||||
const publicPatterns = this.getPublicPatterns();
|
||||
|
||||
// Check exact matches
|
||||
if (publicPatterns.includes(path)) {
|
||||
logger.info('[RouteConfig] Path is public (exact match)', { path });
|
||||
// logger.info('[RouteConfig] Path is public (exact match)', { path });
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -279,19 +279,19 @@ export const routeMatchers = {
|
||||
if (segments.length === 2) {
|
||||
const [group, slug] = segments;
|
||||
if (group === 'leagues' && slug !== 'create') {
|
||||
logger.info('[RouteConfig] Path is public (league detail)', { path });
|
||||
// logger.info('[RouteConfig] Path is public (league detail)', { path });
|
||||
return true;
|
||||
}
|
||||
if (group === 'races') {
|
||||
logger.info('[RouteConfig] Path is public (race detail)', { path });
|
||||
// logger.info('[RouteConfig] Path is public (race detail)', { path });
|
||||
return true;
|
||||
}
|
||||
if (group === 'drivers') {
|
||||
logger.info('[RouteConfig] Path is public (driver detail)', { path });
|
||||
// logger.info('[RouteConfig] Path is public (driver detail)', { path });
|
||||
return true;
|
||||
}
|
||||
if (group === 'teams' && slug !== 'create') {
|
||||
logger.info('[RouteConfig] Path is public (team detail)', { path });
|
||||
// logger.info('[RouteConfig] Path is public (team detail)', { path });
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -306,11 +306,11 @@ export const routeMatchers = {
|
||||
return false;
|
||||
});
|
||||
|
||||
if (isPublicParam) {
|
||||
logger.info('[RouteConfig] Path is public (parameterized match)', { path });
|
||||
} else {
|
||||
logger.info('[RouteConfig] Path is NOT public', { path });
|
||||
}
|
||||
// if (isPublicParam) {
|
||||
// logger.info('[RouteConfig] Path is public (parameterized match)', { path });
|
||||
// } else {
|
||||
// logger.info('[RouteConfig] Path is NOT public', { path });
|
||||
// }
|
||||
|
||||
return isPublicParam;
|
||||
},
|
||||
@@ -326,11 +326,11 @@ export const routeMatchers = {
|
||||
* Check if path requires specific role
|
||||
*/
|
||||
requiresRole(path: string): string[] | null {
|
||||
logger.info('[RouteConfig] requiresRole check', { path });
|
||||
// logger.info('[RouteConfig] requiresRole check', { path });
|
||||
|
||||
// Public routes never require a role
|
||||
if (this.isPublic(path)) {
|
||||
logger.info('[RouteConfig] Path is public, no role required', { path });
|
||||
// logger.info('[RouteConfig] Path is public, no role required', { path });
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -338,14 +338,14 @@ export const routeMatchers = {
|
||||
// Website session roles come from the API and are more specific than just "admin".
|
||||
// Keep "admin"/"owner" for backwards compatibility.
|
||||
const roles = ['admin', 'owner', 'league-admin', 'league-steward', 'league-owner', 'system-owner', 'super-admin'];
|
||||
logger.info('[RouteConfig] Path requires admin roles', { path, roles });
|
||||
// logger.info('[RouteConfig] Path requires admin roles', { path, roles });
|
||||
return roles;
|
||||
}
|
||||
if (this.isInGroup(path, 'sponsor')) {
|
||||
logger.info('[RouteConfig] Path requires sponsor role', { path });
|
||||
// logger.info('[RouteConfig] Path requires sponsor role', { path });
|
||||
return ['sponsor'];
|
||||
}
|
||||
logger.info('[RouteConfig] Path requires no specific role', { path });
|
||||
// logger.info('[RouteConfig] Path requires no specific role', { path });
|
||||
return null;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user