Function Signature
Parameters
The unique identifier of the document room to retrieve.
The user ID (email) of the user requesting access to the document. Must match the authenticated user’s email.
Return Value
Returns the room object with metadata and access configuration, or undefined if an error occurs.
Usage Example
Error Handling
The function performs two levels of authorization:Security
This function implements dual-layer security:
- Validates the authenticated user matches the requesting user
- Checks the user exists in the room’s access control list
Implementation Details
- Access Verification: Checks if userId exists in
room.usersAccesseskeys - Email Validation: Compares authenticated email with userId parameter
- No Side Effects: This is a read-only operation with no cache revalidation
Related Functions
createDocument- Create a new documentupdateDocument- Update document metadataupdateDocumentAccess- Manage document access
Source
Defined inlib/actions/room.actions.ts:54