Put roles into endpoints
This commit is contained in:
@@ -13,7 +13,7 @@ public class CreateUserEndpoint(UsersRepository usersRepository) : Endpoint<Crea
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/users");
|
||||
AllowAnonymous();
|
||||
Roles("Admin");
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CreateUserDto req, CancellationToken ct)
|
||||
|
||||
@@ -15,7 +15,7 @@ public class DeleteUserEndpoint(UsersRepository usersRepository) : Endpoint<Dele
|
||||
public override void Configure()
|
||||
{
|
||||
Delete("/users/{@Id}", x => new { x.Id });
|
||||
AllowAnonymous();
|
||||
Roles("Admin");
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(DeleteUserRequest req, CancellationToken ct)
|
||||
|
||||
@@ -9,7 +9,7 @@ public class GetAllUsersEndpoint(UsersRepository usersRepository) : EndpointWith
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/users");
|
||||
AllowAnonymous();
|
||||
Roles("Admin");
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CancellationToken ct)
|
||||
|
||||
@@ -16,7 +16,7 @@ public class GetUserEndpoint(UsersRepository usersRepository, AutoMapper.IMapper
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/users/{@Id}", x => new { x.Id });
|
||||
AllowAnonymous();
|
||||
Roles("Admin","Employe");
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(GetUserRequest req, CancellationToken ct)
|
||||
|
||||
@@ -12,7 +12,7 @@ public class PatchUserPasswordEndpoint(UsersRepository usersRepository, AutoMapp
|
||||
public override void Configure()
|
||||
{
|
||||
Patch("/users/{@Id}/password", x => new { x.Id });
|
||||
AllowAnonymous();
|
||||
Roles("Admin");
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(PatchUserPasswordDto req, CancellationToken ct)
|
||||
|
||||
@@ -13,7 +13,7 @@ public class UpdateUserEndpoint(UsersRepository usersRepository) : Endpoint<Upda
|
||||
public override void Configure()
|
||||
{
|
||||
Put("/users/{@Id}", x => new { x.Id });
|
||||
AllowAnonymous();
|
||||
Roles("Admin");
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(UpdateUserDto req, CancellationToken ct)
|
||||
|
||||
Reference in New Issue
Block a user