aboutsummaryrefslogtreecommitdiff
path: root/src/Web/DevHive.Web/Controllers/RoleController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Web/DevHive.Web/Controllers/RoleController.cs')
-rw-r--r--src/Web/DevHive.Web/Controllers/RoleController.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Web/DevHive.Web/Controllers/RoleController.cs b/src/Web/DevHive.Web/Controllers/RoleController.cs
index 1465795..ebb305e 100644
--- a/src/Web/DevHive.Web/Controllers/RoleController.cs
+++ b/src/Web/DevHive.Web/Controllers/RoleController.cs
@@ -9,6 +9,9 @@ using Microsoft.AspNetCore.Authorization;
namespace DevHive.Web.Controllers
{
+ /// <summary>
+ /// All endpoints for interacting with the roles layer
+ /// </summary>
[ApiController]
[Route("/api/[controller]")]
public class RoleController
@@ -22,6 +25,11 @@ namespace DevHive.Web.Controllers
this._roleMapper = mapper;
}
+ /// <summary>
+ /// Create a new role for the roles hierarchy. Admin only!
+ /// </summary>
+ /// <param name="createRoleWebModel">The new role's parametars</param>
+ /// <returns>The new role's Id</returns>
[HttpPost]
[Authorize(Roles = "Admin")]
public async Task<IActionResult> Create([FromBody] CreateRoleWebModel createRoleWebModel)
@@ -36,6 +44,11 @@ namespace DevHive.Web.Controllers
new OkObjectResult(new { Id = id });
}
+ /// <summary>
+ /// Get a role's full data, querying it by it's Id
+ /// </summary>
+ /// <param name="id">The role's Id</param>
+ /// <returns>Full info of the role</returns>
[HttpGet]
[Authorize(Roles = "User,Admin")]
public async Task<IActionResult> GetById(Guid id)
@@ -46,6 +59,12 @@ namespace DevHive.Web.Controllers
return new OkObjectResult(roleWebModel);
}
+ /// <summary>
+ /// Update a role's parametars. Admin only!
+ /// </summary>
+ /// <param name="id">The role's Id</param>
+ /// <param name="updateRoleWebModel">The new parametrats for that role</param>
+ /// <returns>Ok result</returns>
[HttpPut]
[Authorize(Roles = "Admin")]
public async Task<IActionResult> Update(Guid id, [FromBody] UpdateRoleWebModel updateRoleWebModel)
@@ -62,6 +81,11 @@ namespace DevHive.Web.Controllers
return new OkResult();
}
+ /// <summary>
+ /// Delete a role. Admin only!
+ /// </summary>
+ /// <param name="id">The role's Id</param>
+ /// <returns>Ok result</returns>
[HttpDelete]
[Authorize(Roles = "Admin")]
public async Task<IActionResult> Delete(Guid id)