@overture-stack/lyric
Version:
Data Submission system
27 lines (26 loc) • 1.07 kB
TypeScript
import type { UserSession } from '../middleware/auth.js';
/**
* Retrieves the list of organizations a user has read access to.
* If the user is an admin, it returns undefined to indicate access to all organizations.
* If no user information is provided, it also returns undefined to allow all access (assuming authentication is not enabled).
* Otherwise, it returns the list of organizations the user is allowed to read from.
* @param organization
* @param user
* @returns
*/
export declare const getUserReadableOrganizations: (user?: UserSession) => string[] | undefined;
/**
* checks if a user has read access to a specific organization.
* Returns true if the user has access, false otherwise.
* @param organization
* @param user
* @returns
*/
export declare const hasUserReadAccess: (organization: string, user?: UserSession) => boolean;
/**
* checks if a user has write access to a specific organization.
* @param organization
* @param user
* @returns
*/
export declare const hasUserWriteAccess: (organization: string, user?: UserSession) => boolean;