acasi-ctf / ctf

Capture the Flag Learning Platform
https://acasi-ctf.github.io/docs
Apache License 2.0
4 stars 2 forks source link

Add admin upload challenge set page. #192

Closed kubeliv closed 2 years ago

kubeliv commented 2 years ago

This pull request adds a hidden page that is only shown to admins. This works by getting the ID token from Auth0, and checking whether the set of roles contains Administrator. If so, it will add a "Upload Challenge Set" menu bar item on the sidebar. This page will show the user a couple of buttons to select a file, then proceed to upload it.

Related issues

Closes #122. Closes #10.

Before

Before this was implemented, I was manually using a curl command to upload these by copying the access token from the browser.

curl -XPOST -F file=@pentesting.zip https://ctf.cyberliteracyforall.com/api/admin/challenge-sets -H "Authorization: Bearer $ACCESS_TOKEN"

After

image

Future work

codecov[bot] commented 2 years ago

Codecov Report

Merging #192 (70f91b3) into main (f6c94a2) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##               main     #192   +/-   ##
=========================================
  Coverage     80.25%   80.25%           
  Complexity       56       56           
=========================================
  Files            19       19           
  Lines           395      395           
  Branches         26       26           
=========================================
  Hits            317      317           
  Misses           60       60           
  Partials         18       18           
Flag Coverage Δ
unittests 80.25% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f6c94a2...70f91b3. Read the comment docs.