Class TenantMembership
- Namespace
- Stratara.Abstractions.Multitenancy
- Assembly
- Stratara.Abstractions.dll
One user's membership in one tenant, carrying the tenant-scoped roles the user holds there. The user↔tenant relationship is many-to-many: a user may hold any number of memberships, each with its own role set, and single-tenant applications are simply the degenerate case of one membership per user.
[ExcludeFromCodeCoverage]
public sealed record TenantMembership : IEquatable<TenantMembership>
- Inheritance
-
TenantMembership
- Implements
- Inherited Members
- Extension Methods
Remarks
Roles are tenant-scoped role names (for example a tenant-administrator role) that apply only within TenantId. They are independent of any global platform roles the identity system may manage elsewhere (such as ASP.NET Identity's role store); authorization components that consume memberships are expected to consult both levels.
A membership with Pending status represents an invitation that has not been accepted yet and confers no access.
Constructors
TenantMembership(Guid, Guid, IReadOnlyCollection<string>, MembershipStatus)
One user's membership in one tenant, carrying the tenant-scoped roles the user holds there. The user↔tenant relationship is many-to-many: a user may hold any number of memberships, each with its own role set, and single-tenant applications are simply the degenerate case of one membership per user.
public TenantMembership(Guid UserId, Guid TenantId, IReadOnlyCollection<string> Roles, MembershipStatus Status = MembershipStatus.Active)
Parameters
UserIdGuidThe user who holds the membership.
TenantIdGuidThe tenant the membership belongs to.
RolesIReadOnlyCollection<string>Tenant-scoped role names the user holds within
TenantId. Nevernull; empty when the user is a plain member without elevated tenant roles.StatusMembershipStatusLifecycle state of the membership; defaults to Active.
Remarks
Roles are tenant-scoped role names (for example a tenant-administrator role) that apply only within TenantId. They are independent of any global platform roles the identity system may manage elsewhere (such as ASP.NET Identity's role store); authorization components that consume memberships are expected to consult both levels.
A membership with Pending status represents an invitation that has not been accepted yet and confers no access.
Properties
Roles
Tenant-scoped role names the user holds within TenantId. Never
null; empty when the user is a plain member without elevated tenant roles.
public IReadOnlyCollection<string> Roles { get; init; }
Property Value
Status
Lifecycle state of the membership; defaults to Active.
public MembershipStatus Status { get; init; }
Property Value
TenantId
The tenant the membership belongs to.
public Guid TenantId { get; init; }
Property Value
UserId
The user who holds the membership.
public Guid UserId { get; init; }