https://github.com/raminrahimzada/aditum
Granular User Management - Users, Groups, Operations, Permissions
https://github.com/raminrahimzada/aditum
access-control authorization csharp user-management
Last synced: 4 days ago
JSON representation
Granular User Management - Users, Groups, Operations, Permissions
- Host: GitHub
- URL: https://github.com/raminrahimzada/aditum
- Owner: raminrahimzada
- Created: 2021-06-01T08:28:01.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-06T08:59:01.000Z (about 5 years ago)
- Last Synced: 2026-06-04T06:06:57.928Z (18 days ago)
- Topics: access-control, authorization, csharp, user-management
- Language: C#
- Homepage:
- Size: 83 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Aditum
Granular User Access Management - Users, Groups, Operations, Permissions (fully thread-safe)
| | |
| --- | --- |
| **Quality** | [](https://sonarcloud.io/dashboard?id=raminrahimzada_Aditum) [](https://github.com/raminrahimzada/Aditum/issues) |
| **Nuget** | [](http://nuget.org/packages/Aditum.Core) |
With Aditum You can set permission to user or group according to Operations
User , Group and Operation details are not stored in Aditum
You can only set it's identity - Id ,
If you want to store additional detail - just store them elsewhere with referencing it's id
Because Aditum is intended only for authorization purposes
Here Id can be int,long,Guid and whatever you want
# Configuration (for asp.net core configuration see [this](https://github.com/raminrahimzada/Aditum/tree/master/DemoAspNetCoreApp))
For example if our user id,group id, operation id is int and our permission is just a bool - yes/no
then
```cs
public class AppUserService : UserService
{
...
```
If we want to mention that we have these users,groups,operations:
```cs
//getting instance
var service = new AppUserService();
//just numbering their id's
//user
const int bob = 1;
const int tom = 2;
//groups
const int admins = 1;
//operations
const int canSeeSecretsOfUniverse = 1;
const int canChangeSecretsOfUniverse = 2;
//mentioning that we have these
service.EnsureUserId(bob);
service.EnsureGroupId(admins);
service.EnsureOperationId(canSeeSecretsOfUniverse);
//change group permissions
service.SetGroupPermission(admins, canSeeSecretsOfUniverse, true);
service.SetGroupPermission(admins, canChangeSecretsOfUniverse, true);
//add tom and bob to admins
service.EnsureUserIsInGroup(bob, admins);
service.EnsureUserIsInGroup(tom, admins);
//deny bob for canChangeSecretsOfUniverse although he is admin
service.SetUserExclusivePermission(bob,admins,false);
//these will return true and true
var tomCanSee = GetUserPermission(tom,canSeeSecretsOfUniverse);
var tomCanChange = GetUserPermission(tom,canChangeSecretsOfUniverse);
//these will return true and false
var bobCanSee = GetUserPermission(bob,canSeeSecretsOfUniverse);
var bobCanChange = GetUserPermission(bob,canChangeSecretsOfUniverse);
//Because we exclusively deny bob for canChangeSecretsOfUniverse operation
//although he is in admins and in admins by default all users can 'canChangeSecretsOfUniverse'
```
# Persistence
```cs
//Aditum has thread-safe change mechanism so you can listen for its setting change event
//to store current settings and load the next time system startup
//For that purpose there is 2 methods
//dumping to file or stream:
service.DumpTo("aditum.db");
//or
service.DumpTo(stream);
//and loading from file or stream :
service.LoadFrom("aditum.db");
//or
service.LoadFrom(stream);
```
Dump/Load is using memory mapped structure and this causes less space (usually in KBs)
To Optimize dump/load speed and storage size customize serialization strategy,
If you are using int,long,guid or byte as id type then there is built in serialization strategies implemented
For detailed configuration code see [this](https://github.com/raminrahimzada/Aditum/blob/master/DemoAspNetCoreApp/AppUserService.cs)