Skip to content

Commit

Permalink
Merge pull request #154 from JJ-8/create-task-access-control
Browse files Browse the repository at this point in the history
Limit task creation by access control
  • Loading branch information
JJ-8 authored Apr 5, 2022
2 parents ec30302 + efb8156 commit b3a9cb2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/src/plugins/createTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ export default makeExtendSchemaPlugin((build) => {
{ pgClient },
resolveInfo
) => {
const {
rows: [isAllowed],
} = await pgClient.query(`SELECT ctfnote_private.can_play_ctf($1)`, [
ctfId,
]);

if (isAllowed.can_play_ctf !== true) {
return {};
}

const padPathOrUrl = await createPad(title, description, category);

let padPath: string;
Expand Down

0 comments on commit b3a9cb2

Please sign in to comment.