pub async fn has_role_in_module(
__arg0: State<AppState>,
__arg1: AuthUser,
__arg2: Query<HasRoleQuery>,
) -> impl IntoResponse
Expand description
GET /api/auth/has-role
Checks if the authenticated user has a specific role in a module.
§Authorization
This endpoint requires a valid bearer token in the Authorization
header.
§Request Parameters
module_id
: The ID of the module to check role forrole
: The role to check for (case-insensitive: “lecturer”, “tutor”, “student”)
§Response: 200 OK
{
"success": true,
"message": "Role check completed",
"data": {
"has_role": true
}
§Error Responses
400 Bad Request
– Invalid role specified403 Forbidden
– Missing or invalid token500 Internal Server Error
– Database failure