mirror of
https://github.com/outline/outline.git
synced 2026-11-22 14:01:41 +03:00
Documents can now have owners, stored as an array of user IDs. Owners must be active members or admins, and changing them requires the existing manage users permission on the document, gated behind a new DocumentOwners plan entitlement that is included in every plan. - ownerIds accepted by documents.create and documents.update and returned by the document presenter - ownerIds filter field (eq/in) for documents.list and documents.search - ownerIds on the MCP create_document and update_document tools, and an ownerId filter on list_documents - Owners section in the document Insights dialog to add and remove owners - Owner filter on the search page - In-app and email notification when a user is made an owner Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016MJXFdSZ39ZGPf31jyGcYz
69 lines
2.2 KiB
TypeScript
69 lines
2.2 KiB
TypeScript
import { Plan, PlanFeature } from "../types";
|
|
|
|
/**
|
|
* Describes the features that are included in each plan.
|
|
*
|
|
* IMPORTANT NOTICE: Bypassing or modifying license controls is a breach of
|
|
* the license agreement, and will automatically terminate your rights under
|
|
* the license for the current and all other versions.
|
|
*/
|
|
export class PlanHelper {
|
|
/** Plans that can be chosen, ordered from lowest to highest. */
|
|
public static readonly plans: Plan[] = [
|
|
Plan.Community,
|
|
Plan.Standard,
|
|
Plan.Business,
|
|
Plan.Enterprise,
|
|
];
|
|
|
|
/** The plan that a team gets when no other plan applies. */
|
|
public static readonly defaultPlan = Plan.Community;
|
|
|
|
/** The features that are included in each plan. */
|
|
public static readonly features: Record<Plan, PlanFeature[]> = {
|
|
[Plan.Community]: [PlanFeature.DocumentOwners],
|
|
[Plan.Standard]: [
|
|
PlanFeature.DocumentOwners,
|
|
PlanFeature.ContentManagement,
|
|
PlanFeature.Guests,
|
|
PlanFeature.AIAnswers,
|
|
],
|
|
[Plan.Business]: Object.values(PlanFeature),
|
|
[Plan.Enterprise]: Object.values(PlanFeature),
|
|
[Plan.Legacy]: Object.values(PlanFeature).filter(
|
|
(feature) => feature !== PlanFeature.GroupSync
|
|
),
|
|
};
|
|
|
|
/**
|
|
* Get the features that are included in a plan.
|
|
*
|
|
* @param plan the plan to get the features for.
|
|
* @returns the features included in the plan.
|
|
*/
|
|
public static getFeatures(plan: Plan): PlanFeature[] {
|
|
return this.features[plan] ?? [];
|
|
}
|
|
|
|
/**
|
|
* Check if a plan includes a feature.
|
|
*
|
|
* @param plan the plan to check.
|
|
* @param feature the feature to check for.
|
|
* @returns true if the plan includes the feature.
|
|
*/
|
|
public static hasFeature(plan: Plan, feature: PlanFeature): boolean {
|
|
return this.getFeatures(plan).includes(feature);
|
|
}
|
|
|
|
/**
|
|
* Get the lowest plan that can be chosen and includes a feature, for example to show in an upgrade prompt.
|
|
*
|
|
* @param feature the feature to find a plan for.
|
|
* @returns the lowest plan that includes the feature, or undefined if no plan does.
|
|
*/
|
|
public static getMinimumPlan(feature: PlanFeature): Plan | undefined {
|
|
return this.plans.find((plan) => this.hasFeature(plan, feature));
|
|
}
|
|
}
|