Hursey
Hursey

Reputation: 551

.net core identity customization

Want to check to make sure I'm not barking up the wrong tree before I get too comited. I'm developing a web app using asp.net core for customer order entry and management and I'm a little stuck on how to handle the user authentication side of things. I've been looking at using Identity for this, but the examples I've found don't really seem to cover what I'm after.

The situation is this. I've got an top level organisation, which has many warehouses which has many users and many customers, And each customer also has many users (Different users to the warehouse).

At the organisation level, when creating a new warehouse I want to create a Warehouse admin, this warehouse admin will be able to maintain customers, create warehouse users and view/edit/add all orders for the warehouse customers. Next when customers are added, they need to be assigned to a specifc customer. Users can view/maintain all orders for the assigned customer.

I was thinking I could use Identity Roles to split the different types of users and preform different tasks and allow different actions etc. based on those roles but is it fesiable to use .net core Identity for this type if situation?

Upvotes: 0

Views: 197

Answers (2)

citronas
citronas

Reputation: 19365

Yes, you can use .NET Core Identity for this. We have a similar role-based setup with 3 roles in one of our projects. Each user will be assigned a role (admin, customer or user). Make sure that each users has an assigned warehouse (e.g., WarehouseId).

Based upon the role, you can filter users lists, e.g., only showing users for customers of their own warehouse, but all users for the global admin.

You can restrict each controller method by role and filter the data by the WarehouseId of the logged in user.

Upvotes: 1

timur
timur

Reputation: 14567

Sounds like you're on the right track with authentication (checking if users are allowed to access the system). Now for your use case you might want to ensure you're reading up about Authorisation (what users can do after they are authenticated). The official documentation follows an example of building a web app with user roles, which might the example you're looking for.

Both flows are part of the same ASP.NET Core Security framework

Upvotes: 1

Related Questions