GitLab steht wegen Wartungsarbeiten am Montag, den 10. Mai, zwischen 17:00 und 19:00 Uhr nicht zur Verfügung.

Add listUsers and setUserRole route

Signed-off-by: Jonas-Ian Kuche's avatarJonas-Ian Kuche <jonas-ian.kuche@mni.thm.de>
parent 1186059e
......@@ -1209,18 +1209,22 @@ paths:
$ref: '#/components/responses/ForbidenError'
'404':
$ref: '#/components/responses/NotFoundError'
/api/courses/{courseID}/participants:
/api/courses/{courseID}/users:
get:
operationId: listParticipants
summary: Lists the participants in the Course
operationId: listUsers
summary: Lists the users in the Course
tags:
- course
parameters:
- $ref: '#/components/parameters/CourseID'
- in: query
name: hideAdmins
name: role
schema:
type: boolean
type: array
items:
type: string
enum: ['student', 'author', 'admin', 'docent']
default: ['student', 'author', 'admin', 'docent']
security:
- userBearer: []
responses:
......@@ -1231,40 +1235,13 @@ paths:
schema:
type: array
items:
$ref: '#/components/schemas/User'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/UnauthorizedError'
'403':
$ref: '#/components/responses/ForbidenError'
/api/courses/{courseID}/admins:
post:
operationId: addCourseAdmin
summary: Adds a Course Admin
tags:
- course
parameters:
- $ref: '#/components/parameters/CourseID'
security:
- userBearer: []
requestBody:
content:
application/json:
schema:
type: object
properties:
username:
type: string
example: 'username'
required: [username]
responses:
'200':
description: The added course admin
content:
application/json:
schema:
$ref: '#/components/schemas/User'
type: object
properties:
user:
$ref: '#/components/schemas/User'
role:
type: string
enum: [ 'student', 'author', 'admin', 'docent' ]
'400':
$ref: '#/components/responses/BadRequest'
'401':
......@@ -1273,52 +1250,32 @@ paths:
$ref: '#/components/responses/ForbidenError'
'404':
$ref: '#/components/responses/NotFoundError'
'409':
$ref: '#/components/responses/ConflictError'
get:
operationId: listCourseAdmins
summary: Get a list of course admins
/api/courses/{courseID}/users/{userID}:
put:
operationId: setUserRole
summary: Sets the role of the user (also adds the user to the course if he is currently not)
tags:
- course
parameters:
- $ref: '#/components/parameters/CourseID'
- $ref: '#/components/parameters/UserID'
security:
- userBearer: []
responses:
'200':
description: The list of course admins
description: A list of all participants of the course
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/UnauthorizedError'
'403':
$ref: '#/components/responses/ForbidenError'
'404':
$ref: '#/components/responses/NotFoundError'
/api/courses/{courseID}/admins/{userID}:
delete:
operationId: removeCourseAdmin
summary: Removes a Couse Admin
tags:
- course
parameters:
- $ref: '#/components/parameters/CourseID'
- $ref: '#/components/parameters/UserID'
security:
- userBearer: []
responses:
'200':
description: The removed course admin
content:
application/json:
schema:
$ref: '#/components/schemas/User'
type: object
properties:
user:
$ref: '#/components/schemas/User'
role:
type: string
enum: [ 'student', 'author', 'admin', 'docent', 'none' ]
'400':
$ref: '#/components/responses/BadRequest'
'401':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment