The implementation is based on the permify and other ReBac open source projects.
The library is designed to be simple and easy to use. Each subset of functionality is divided in engines. The engines are:
- DataEngine: The engine that handles the write and deletion of relation tuples and attributes.
- Read here about how the relational data is stored.
- CheckEngine: The engine that handles the answering of two questions:
Can entity U perform action Y in resource Z
? For that, use theCheck
function.What permissions entity U have in resource Z
? For that, use theSubjectPermission
function.
- LookupSubjectEngine: The engine that can answer:
Which subjects of type T have permission Y on entity:X?
For that, use theLookup
function. - LookupEntityEngine: The engine that can answer:
Which resources of type T can entity:X have permission Y?
For that, use theLookupEntity
function.
Install the package from NuGet:
dotnet add package Valtuutus.Data.Postgres
dotnet add package Valtuutus.Data.SqlServer
builder.Services.AddValtuutusCore(c =>
...
See examples of how to define your schema here.
builder.Services.AddValtuutusDatabase(() => new NpgsqlConnection(builder.Configuration.GetConnectionString("PostgresDb")!), a => a.AddPostgres());
builder.Services.AddValtuutusDatabase(() => new SqlConnection(builder.Configuration.GetConnectionString("SqlServerDb")!), a => a.AddSqlServer());
The library uses OpenTelemetry to provide telemetry data. To enable it, just add a source with the name "Valtuutus":
builder.Services
.AddOpenTelemetry()
.WithTracing(telemetry =>
{
telemetry
.AddSource("Valtuutus")
...