Somum.AccessControl.Requests
10.1.6
dotnet add package Somum.AccessControl.Requests --version 10.1.6
NuGet\Install-Package Somum.AccessControl.Requests -Version 10.1.6
<PackageReference Include="Somum.AccessControl.Requests" Version="10.1.6" />
<PackageVersion Include="Somum.AccessControl.Requests" Version="10.1.6" />
<PackageReference Include="Somum.AccessControl.Requests" />
paket add Somum.AccessControl.Requests --version 10.1.6
#r "nuget: Somum.AccessControl.Requests, 10.1.6"
#:package Somum.AccessControl.Requests@10.1.6
#addin nuget:?package=Somum.AccessControl.Requests&version=10.1.6
#tool nuget:?package=Somum.AccessControl.Requests&version=10.1.6
Somum.AccessControl.Requests
Somum.AccessControl.Requests is a .NET Standard 2.0 class library that defines the command and query contracts for Somum access-control resources.
It provides transport models for managing access profiles, groups, and roles. The project contains request payloads, response contracts, optional expansion flags, and route metadata; validation, authorization, persistence, and business workflows are implemented by the corresponding handler projects.
Target Framework and Dependencies
- Target framework: .NET Standard 2.0
- Project dependencies:
Somum.DtosforAccessProfileDto,GroupDto,RoleDto, and permission DTOsSomum.Requestsfor base command/query types and endpoint abstractions
Access-Control Model
The request contracts represent three related resources:
| Resource | Purpose |
|---|---|
| Access profile | A named collection of groups and roles that describes an assignable permission profile. |
| Group | A reusable access-control group (also referred to internally as a circle). |
| Role | A named set of permissions; each permission grants an access level to a feature. |
An access profile can associate existing groups and roles by identifier or create new groups and roles inline as part of the same create request.
Commands
Create an access profile
AddAccessProfileCommand creates an access profile from AddAccessProfileCommandPayload.
The payload supports two association paths:
GroupIdsandRoleIdslink existing groups and roles.GroupsandRolescreate groups and roles inline, then associate the newly created resources with the profile.
The command accepts AccessProfileExpand[] through Expand to shape the creation response. Its response, AddAccessProfileCommandResponse, inherits GetAccessProfileQueryResponse so creation and retrieval use the same returned access-profile contract.
Create a group
AddGroupCommand creates a group from AddGroupCommandPayload, which contains a display Name and optional Description.
GroupExpand[] can be supplied through Expand to request optional related data in AddGroupCommandResponse.
Create a role
AddRoleCommand creates a role from AddRoleCommandPayload.
A role payload includes:
Name— the role display name.Description— an optional human-readable description.Permissions— feature and access-level pairs represented byAddRoleCommandPayloadPermission.
GetRoleExpand[] can be supplied through Expand to request optional role data, including permissions where supported, in AddRoleCommandResponse.
Queries
The project provides single-resource and paged collection queries for each access-control resource.
| Resource | Single query | Collection query |
|---|---|---|
| Access profiles | GetAccessProfileQuery |
GetAccessProfilesQuery |
| Groups | GetGroupQuery |
GetGroupsQuery |
| Roles | GetRoleQuery |
GetRolesQuery |
Single-resource queries use an Id route parameter. Collection queries inherit filtering, sorting, and pagination options from NavigatingQuery<TResponse>.
Each query can specify the matching expand enum to request optional related data:
AccessProfileExpandGroupExpandGetRoleExpand
Endpoints
Routing metadata is implemented in the .Routing.cs partial files. Each request exposes a ResourcePath constant and resolves the final endpoint through its overridden Endpoint property.
| Operation | Resource path |
|---|---|
| List/create access profiles | RequestEndpointsHelpers.AccessProfilesResourceName |
| Get one access profile | RequestEndpointsHelpers.AccessProfilesResourceName/{id} |
| List/create groups | RequestEndpointsHelpers.GroupsResourceName |
| Get one group | RequestEndpointsHelpers.GroupsResourceName/{id} |
| List/create roles | RequestEndpointsHelpers.RolesResourceName |
| Get one role | RequestEndpointsHelpers.RolesResourceName/{id} |
The API project binds these contracts to versioned HTTP endpoints, while the same contracts can be sent through the mediator layer.
Handler Behavior
This project intentionally contains no business logic. In the associated handler projects:
- Access-profile reads are permission-scoped. Super users can retrieve all profiles; other callers are filtered according to their assigned rights.
- Access-profile creation validates that provided existing group and role identifiers exist and are authorized for the current account.
- Inline group and role payloads are dispatched as create commands before their resulting identifiers are associated with the new access profile.
- Create handlers re-query newly created resources so the response honors the supplied expansion options.
Usage
Reference the project from another project in the solution:
<ItemGroup>
<ProjectReference Include="..\Somum.AccessControl.Requests\Somum.AccessControl.Requests.csproj" />
</ItemGroup>
Create an access profile that links existing resources:
using Somum.AccessControl.Commands;
var command = new AddAccessProfileCommand
{
Payloads = new AddAccessProfileCommandPayload
{
Name = "Campaign managers",
Description = "Access profile for campaign management.",
GroupIds = new List<long> { groupId },
RoleIds = new List<long> { roleId }
}
};
Contract Evolution
These models are shared API and mediator contracts. When changing them:
- Preserve route constants, public property names, and serialization attributes.
- Prefer additive, nullable properties over breaking removals or renames.
- Keep validation and authorization logic in sanitizer and handler projects.
- Update handlers, endpoint documentation, mappings, and tests when a request or response contract changes.
- Add versioned contracts when a breaking change is unavoidable.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Somum.Dtos (>= 10.1.6)
- Somum.Requests (>= 10.1.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.