I'm trying to build ASP.NET core api where I have a few group of users. These groups have a common database, but from there they can only see the records assigned to them.
For example the user XYZ calling the controller returning the values from the Products table sees only those that were assigned to his group. And the same when he adds a new Product, only the users of his group see it, and other groups do not know about the existence of this Product.
I would like to ask you to explain to me how to do it in ASP.NET core, what libraries I could use, because unfortunately I don't know how to do it.
Thank you in advance for your help.
I don't think you need to search for a library or a framework to build this out, you can do the implementation as follows,
ProductPermissions
UserDetails
, UserGroups
, UserRoles
etcGetProducts
API.ProductPermissions
table with the keys and filter by the groupid that I have been assigned.ProductPermissions
table.Note
In order to get a generic table than redundant ProductPermissions
, you can have the table as EntityPermissions
and then have the entityId (ex: Product
, Category
etc) as a column and that will be used a filter during joining so that you have a single table for all entities.