Feature/Auth: last one was authentication, this one is authorization #4
@@ -20,7 +20,7 @@ public class UsersController : ControllerBase {
|
|||||||
service_ = service;
|
service_ = service;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authorize(Policy = "RequireAdmin")]
|
[Authorize(Policy = "SensitiveDataRead")]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<ActionResult<List<User>>> getUsers() {
|
public async Task<ActionResult<List<User>>> getUsers() {
|
||||||
List<User> rawArray = await service_.GetAll();
|
List<User> rawArray = await service_.GetAll();
|
||||||
@@ -42,7 +42,7 @@ public class UsersController : ControllerBase {
|
|||||||
return Ok(dtoArray);
|
return Ok(dtoArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authorize(Policy = "RequireAdmin")]
|
[Authorize(Policy = "SensitiveDataRead")]
|
||||||
[HttpGet("{id:int}")]
|
[HttpGet("{id:int}")]
|
||||||
public async Task<ActionResult<User>> getUser(int id) {
|
public async Task<ActionResult<User>> getUser(int id) {
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ public class UsersController : ControllerBase {
|
|||||||
return Ok(newDto);
|
return Ok(newDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authorize(Policy = "RequireSuperuser")]
|
[Authorize(Policy = "SensitiveDataModify")]
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
public async Task<ActionResult> deleteUser(int id) {
|
public async Task<ActionResult> deleteUser(int id) {
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ To see live logs:
|
|||||||
sudo docker logs -f -t agologum-api
|
sudo docker logs -f -t agologum-api
|
||||||
|
|
||||||
public user:
|
public user:
|
||||||
> username=bard
|
> username=bard (admin)
|
||||||
|
> username=xvbard (superuser)
|
||||||
> password=Public*890
|
> password=Public*890
|
||||||
|
|
||||||
chrome dev tools troubleshooting
|
chrome dev tools troubleshooting
|
||||||
|
|||||||
Reference in New Issue
Block a user