20 lines
498 B
TypeScript
20 lines
498 B
TypeScript
/**
|
|
* @dbis/shared-auth
|
|
* Shared authentication utilities for DBIS projects
|
|
*/
|
|
|
|
// Re-export workspace shared auth
|
|
export * from '@workspace/shared-auth';
|
|
|
|
// DBIS-specific auth utilities
|
|
export function hasDBISRole(user: { roles: string[] }, role: string): boolean {
|
|
return user.roles.includes(role);
|
|
}
|
|
|
|
export function requireDBISRole(user: { roles: string[] }, role: string): void {
|
|
if (!hasDBISRole(user, role)) {
|
|
throw new Error(`User does not have required role: ${role}`);
|
|
}
|
|
}
|
|
|