- ABP Framework version: v8.2.0
- UI Type: Blazor Server
- Database System: EF Core (SQL Server,
- Tiered (for MVC) or Auth Server Separated (for Angular): yes
I need a suggestion.
We have 3 users (mark, james and roger), grouped in 2 roles (admin (mark and james) and viewer(roger)).
We have a domain entity called customer with 5 properties (name, surname, address, city, vatID)
admin users can edit and view all the properties viewer users can edit only the name and the surname e view the adress, city and vatID james can only view name and surname
We need to manage this in the front end and also in the API (if james is logged in swagger he haven't to see the value of the fields)
How we can manage this by ABP framework?
4 Answer(s)
-
0
hi
You can check the permissions of current users in the application service layer.
Then, fill the entity properties to dto.
If there is no permission, set the DTO property to
emptyornull.Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Do you have an example code of something similar?
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
I haven't understand how to do this.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
This is very simple. You only need to check the current user's permissions and then set values ββfor the DTO class in application services.
https://abp.io/docs/latest/framework/fundamentals/authorization#iauthorizationservice
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)