Initial commit: add .gitignore and README
This commit is contained in:
19
packages/shared-auth/src/index.ts
Normal file
19
packages/shared-auth/src/index.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @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}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user