(role: string)
| 2 | * Normalize a role name by removing common prefixes (ORG:, ORG_, etc.) |
| 3 | */ |
| 4 | export function normalizeRole(role: string): string { |
| 5 | let normalized = role.toUpperCase(); |
| 6 | // Remove "ORG:" prefix if present |
| 7 | if (normalized.startsWith('ORG:')) { |
| 8 | normalized = normalized.substring(4); |
| 9 | } |
| 10 | // Remove "ORG_" prefix if present |
| 11 | if (normalized.startsWith('ORG_')) { |
| 12 | normalized = normalized.substring(4); |
| 13 | } |
| 14 | return normalized; |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Check if a user has admin role |