the-poolz / acl.net.core Goto Github PK
View Code? Open in Web Editor NEWA comprehensive .NET Core library for managing Access Control Lists (ACL) designed to be used with Entity Framework Core
License: MIT License
A comprehensive .NET Core library for managing Access Control Lists (ACL) designed to be used with Entity Framework Core
License: MIT License
Add one new override of IsPermitted
and IsPermittedAsync
functions.
In these methods need to call GetResourceByName
or GetResourceByNameAsync
public virtual bool IsPermitted(TUser user, string resource);
public virtual async Task<bool> IsPermittedAsync(TUser user, string resource)
It's need for prevent call two methods in AclManager
var resource = resourceManager.GetResourceByName(resourceName);
return resourceManager.IsPermitted(user, resource);
Change AclDbContext<TKey, TUser>
to AclDbContext<TKey>
Change AclManager<TKey, TUser>
to AclManager<TKey>
If user need to override one of the tables, he can use <TKey, TUser, TRole, TResource>
overload
@Lomet Can you add this repository to sonarcloud?
Add new property Name
for model User
and implement new override of method IsPermitted
in AclManager
Using environment for stored secret it's bad idea. Better add ISecretProvider
interface
Right now: Roles contain UserId
Need to be: User contain RoleId
I think it's better because right now in table Roles be many duplicate roles, and because of this many duplicates in Resources table
Reason - don't supported, split by two package
add badges
May be better use SHA-256 algorithm instead of AES? We don't need to recover input data. I think in our system better use one-way algorithm.
https://chat.openai.com/share/d72e2304-dff0-4872-8ecf-387c57ef4f5e
Acl.cs
. Instead of this, we write AclManager
who will contain only needed methods.Backend.cs
. Instead of this, we write DataProvider
who will contain only needed methods.Interfaces
folder.Utils.cs
.Permission
.User = string[] RoleNames
.RoleParentNotFoundException.cs
Make new PK (Name + RoleId). (This PK can make user in his context)
It's allow situation when DB contain two resources with the same name, but with different role.
Example:
Roles:
Resources:
In this example, we allow only AdminRole and SuperAdminRole, to call OnlyAdminResource
Also, need to update ResourceManager
in overrides which receive IEnumerable<TResource> resources
need to check if these resources
has the same name. This move need to prevent this situation:
Roles:
Resources:
User call PublicResource and AdminResource with override which receive IEnumerable<TResource> resources
and receive true because least one resource allow (in this situation allowed PublicResource)
IUserManager
for possible override default UserManager
IResourceManager
for possible override default ResourceManager
This table will contain users tokens
Add ctor with one parameter context
. And initialize default implementations of IUserManager
and IResourceManager
public virtual bool IsPermitted(TUser user, string resourceName)
public virtual bool IsPermitted(string userName, TResource resource)
public virtual bool IsPermitted(TUser user, TResource resource)
Add the same overrides, but for IsPermittedAsync
MsSql.cs
UserId
from User
split AclManager
into two separate classes, UserManager
and ResourceManager
Let's use Where()
function instead of FirstOrDefault
here:
Acl.Net.Core/src/Acl.Net.Core/Managers/ResourceManager.cs
Lines 54 to 64 in 9af8083
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.