mirror of
https://github.com/outline/outline.git
synced 2026-06-13 03:14:59 +03:00
b4cbb39f17
* feat: Request document access Allow users without permission to a document to request access. Notifies document managers via in-app notification and email; managers can grant or dismiss the request. - Adds AccessRequest model, migration, policy, presenter - Adds accessRequests.create/info/approve/dismiss endpoints - Adds DocumentAccessRequestNotificationsTask + email - Adds Error403 request flow with loading state and pending indicator - Auto-opens notifications popover via ?notifications=true (used in email) - Adds SplitButton primitive for permission selection in notifications - Refactors useConsumeQueryParam hook * refactor * fix: Make approve/dismiss idempotent on access requests Return success when the access request has already been dismissed, or when the user already has document membership at approve time, instead of throwing 400. Avoids racy double-clicks on notification actions producing user-visible errors. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * Minor fixes --------- Co-authored-by: Tom Moor <tom@getoutline.com> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
15 lines
352 B
TypeScript
15 lines
352 B
TypeScript
import { AccessRequest, User } from "@server/models";
|
|
import { allow } from "./cancan";
|
|
import { isOwner, isTeamModel, or, and } from "./utils";
|
|
|
|
allow(
|
|
User,
|
|
["read", "update", "delete"],
|
|
AccessRequest,
|
|
(actor, accessRequest) =>
|
|
and(
|
|
isTeamModel(actor, accessRequest),
|
|
or(actor.isAdmin, isOwner(actor, accessRequest))
|
|
)
|
|
);
|