MintPlayer.Spark.Organizations
11.0.0
dotnet add package MintPlayer.Spark.Organizations --version 11.0.0
NuGet\Install-Package MintPlayer.Spark.Organizations -Version 11.0.0
<PackageReference Include="MintPlayer.Spark.Organizations" Version="11.0.0" />
<PackageVersion Include="MintPlayer.Spark.Organizations" Version="11.0.0" />
<PackageReference Include="MintPlayer.Spark.Organizations" />
paket add MintPlayer.Spark.Organizations --version 11.0.0
#r "nuget: MintPlayer.Spark.Organizations, 11.0.0"
#:package MintPlayer.Spark.Organizations@11.0.0
#addin nuget:?package=MintPlayer.Spark.Organizations&version=11.0.0
#tool nuget:?package=MintPlayer.Spark.Organizations&version=11.0.0
MintPlayer.Spark.Organizations
Organizations for MintPlayer.Spark (docs/seo_analyzer_PRD.md X11): users work together in
organizations, and documents that carry an OrganizationId are visible only to the members of that
organization, with the role each action needs. Depends on MintPlayer.Spark.Authorization only.
- Roles
Owner > Admin > Member > Viewer, ordered. What each may do is declared per type with[RequiresOrganizationRole(action, role)]; defaults: Viewer reads, Member creates and edits, Admin deletes. - Every user has a personal organization, created on first sign-in: their default, owned by them for good. Others join it like any other organization (D42); its Owner role never changes hands.
- Invitations by email (Admin and up) and join requests raised by application code
(
ISparkOrganizations.RequestToJoinAsync), both mailed with a single-use acceptance link that expires after 14 days (expiresAfteronOrganizationInvitation). Only the token's SHA-256 is stored. The mail goes out on the sender's behalf, so the inviter (or the join requester) needs a confirmed email address (D43). An invitation is accepted only by the account whose address is the invited one, confirmed or not; a join request is approved by an Owner or Admin. - The last Owner cannot leave; ownership is transferred to a member.
- Deleting an organization cascades: every
IOrganizationDataHandlerdeletes the application's data first, then memberships and invitations go. Deleting an account deletes the personal organization and every membership. The account's personal-data export gains anorganizationssection.
Setup
builder.Services.AddSpark(builder.Configuration, spark =>
{
spark.AddAuthentication<SparkUser>();
spark.AddMailManager(); // the invitation mails; without it they are discarded with a warning
spark.AddOrganizations();
});
App_Data/security.json of the application (startup is refused without the binding):
"bindings": { "organizations:users": [ "Users" ] }
Set Spark:Auth:PublicBaseUrl (the mailed links use it; outside Development nothing is mailed without it).
Organization-owned types
[RequiresOrganizationRole("New", OrganizationRole.Admin)]
[RequiresOrganizationRole("Delete", OrganizationRole.Admin)]
public class Site : IOrganizationOwned
{
public string? Id { get; set; }
public string? OrganizationId { get; set; }
public string Origin { get; set; } = "";
}
That is the whole row rule. A non-member gets the missing-row 404 on a load and never sees the row in a list, a sub-query, a reference picker or a custom-action selection.
Cascade and export
public sealed class SiteData(IDocumentStore store) : IOrganizationDataHandler
{
public string Name => "sites";
public async Task<object?> ExportAsync(Organization organization, CancellationToken ct) { … }
public async Task DeleteAsync(Organization organization, CancellationToken ct) { … } // idempotent
}
builder.Services.AddScoped<IOrganizationDataHandler, SiteData>();
The acceptance page
The link opens {PublicBaseUrl}/organizations/accept/{token}?id={invitationId}. ng-spark ships the page:
add withOrganizationRoutes() to sparkAuthRoutes(...). It posts the two values to
POST /spark/organizations/accept on an explicit click. Change the path with Spark:Organizations:AcceptPath.
The organization switcher. <spark-organization-switcher> (ng-spark /organizations) picks a current
organization, kept in a cookie and checked against the caller's memberships on every request. Lists of
IOrganizationOwned rows show only its rows (detail pages, sub-queries and the organization list do not narrow),
and a create whose form names no organization lands there, else in the personal one.
GET|POST /spark/organizations/current; ISparkOrganizations.GetCurrentOrganizationIdAsync().
Guide: docs/guide-organizations.md.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- MintPlayer.AspNetCore.Endpoints (>= 11.4.1)
- MintPlayer.SourceGenerators.Attributes (>= 13.1.2)
- MintPlayer.Spark (>= 11.1.0)
- MintPlayer.Spark.Authorization (>= 11.0.1)
- MintPlayer.Spark.RavenDB (>= 11.0.0)
- RavenDB.Client (>= 7.2.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.0 | 87 | 11/18/2026 |