Function Signature
Parameters
The unique identifier of the document room.
The email address of the collaborator to remove.
Return Value
Returns the updated room object with the collaborator removed from access, or undefined if an error occurs.
Usage Example
Error Handling
The function enforces several validation and permission checks:Implementation Details
- Null Assignment: Removes access by setting the user’s permissions to
null - Owner Check: Compares removal target with
room.metadata.email(creator) - Cache Revalidation: Revalidates
/documents/{roomId}path - Permission Verification: Verifies requesting user has write access
Access Removal
null completely removes them from the document’s access control list.
Use Cases
Common scenarios for removing collaborators:
- Revoking access for team members who left the project
- Removing viewers who no longer need access
- Managing access control as document permissions change
Permission Requirements
Only users with
room:write permissions can remove collaborators. This typically includes:- Document creator (owner)
- Collaborators with editor access
room:read access cannot remove collaborators.Related Functions
updateDocumentAccess- Grant or update collaborator accessdeleteDocument- Delete the entire documentgetDocument- Retrieve document and access information
Related Types
Source
Defined inlib/actions/room.actions.ts:169