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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MintPlayer.Spark.Organizations" Version="11.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MintPlayer.Spark.Organizations" Version="11.0.0" />
                    
Directory.Packages.props
<PackageReference Include="MintPlayer.Spark.Organizations" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MintPlayer.Spark.Organizations --version 11.0.0
                    
#r "nuget: MintPlayer.Spark.Organizations, 11.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MintPlayer.Spark.Organizations@11.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MintPlayer.Spark.Organizations&version=11.0.0
                    
Install as a Cake Addin
#tool nuget:?package=MintPlayer.Spark.Organizations&version=11.0.0
                    
Install as a Cake Tool

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 (expiresAfter on OrganizationInvitation). 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 IOrganizationDataHandler deletes 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 an organizations section.

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 Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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