Oip.Api
0.0.11
dotnet add package Oip.Api --version 0.0.11
NuGet\Install-Package Oip.Api -Version 0.0.11
<PackageReference Include="Oip.Api" Version="0.0.11" />
<PackageVersion Include="Oip.Api" Version="0.0.11" />
<PackageReference Include="Oip.Api" />
paket add Oip.Api --version 0.0.11
#r "nuget: Oip.Api, 0.0.11"
#:package Oip.Api@0.0.11
#addin nuget:?package=Oip.Api&version=0.0.11
#tool nuget:?package=Oip.Api&version=0.0.11
OIP API Modules Library
The library provides basic infrastructure for creating and managing modules in OIP API applications built on ASP.NET Core.
Overview
The library contains base controllers and classes for working with application modular architecture, including module management, security settings, and database migrations.
Core Components
1. BaseModuleController<TSettings>
Base controller for modules providing common functionality:
- Security Management: Access rights and roles for modules
- Module Settings: JSON serialization/deserialization of settings
- Base Rights: Standard access rights (read, admin)
public abstract class BaseModuleController<TSettings>(ModuleRepository moduleRepository)
: ControllerBase where TSettings : class
2. BaseDbMigrationController<TSettings>
Specialized controller for managing database migrations:
- Migration Viewing: Get list of all migrations with their status
- Migration Application: Automatic and manual migration application
- Administrative Access: Only for users with admin role
public abstract class BaseDbMigrationController<TSettings> : BaseModuleController<TSettings>
where TSettings : class
3. ModuleController
Controller for managing system modules:
- CRUD Operations: Add, remove, and get modules
- Loading Status: Track loaded modules
- Administrative Interface: Full system module management
4. FolderModuleController
Example implementation of a specific module - folder module:
- Inheritance from BaseModuleController: Using base functionality
- Specific Settings: HTML content for the module
- Custom Rights: Defining access rights for specific module
Functionality
Security Management
- Dynamic management of module access rights
- Role-based security model
- REST API for rights management
Module Settings
- Flexible settings system via JSON serialization
- Instance-specific settings for each module instance
- Administrative interface for modifying settings
Database Migrations
- Full control over Entity Framework Core migrations
- View migration status (applied, pending, existing)
- Safe migration application via API
Usage
Creating a New Module
[ApiController]
[Route("api/my-module")]
public class MyModuleController : BaseModuleController<MyModuleSettings>
{
public override List<SecurityResponse> GetModuleRights()
{
// Define access rights for the module
}
}
public class MyModuleSettings
{
// Specific module settings
}
Working with Migrations
public class MyModuleWithMigrationsController
: BaseDbMigrationController<MyModuleSettings>
{
public MyModuleWithMigrationsController(
ModuleRepository repository,
DbContext dbContext)
: base(repository, dbContext)
{
}
}
Requirements
- ASP.NET Core
- Entity Framework Core
- Role-based authorization
- JSON serialization (Newtonsoft.Json)
Security
All administrative operations are protected by the [Authorize(Roles = SecurityConstants.AdminRole)] attribute and are
accessible only to users with administrator role.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. |
-
net8.0
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 8.0.22)
- Microsoft.AspNetCore.SpaServices.Extensions (>= 8.0.22)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Http.Polly (>= 8.0.22)
- Microsoft.Extensions.Http.Resilience (>= 8.0.0)
- Microsoft.IdentityModel.JsonWebTokens (>= 8.2.1)
- Newtonsoft.Json (>= 13.0.3)
- NLog.Web.AspNetCore (>= 5.3.15)
- Oip.Base (>= 0.0.11)
- Oip.Data (>= 0.0.11)
- Oip.Settings (>= 1.3.0)
- Polly (>= 8.5.0)
- Polly.Extensions.Http (>= 3.0.0)
- Swashbuckle.AspNetCore (>= 8.1.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.