Skip to content

Commit

Permalink
This time with permissions!
Browse files Browse the repository at this point in the history
  • Loading branch information
palmertab committed Nov 15, 2023
1 parent 0560772 commit fedf5cc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
18 changes: 18 additions & 0 deletions api/controllers/tourn/section/mergeRounds.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { roundCheck } from '../../../helpers/auth.js';

// Merges and unmerges all the rounds in a given timeslot and judge category
// for unified judge placement. This method should be more robust than the
// stash & store method.
Expand All @@ -9,6 +11,14 @@ export const mergeTimeslotRounds = {
const db = req.db;
const roundId = req.params.roundId;

const permOK = await roundCheck(req, res, roundId);
if (!permOK) {
res.status(200).json({
error : true,
message : `You do not have permission to merge those rounds`,
});
}

try {
await db.sequelize.query(`
update
Expand Down Expand Up @@ -59,6 +69,14 @@ export const unmergeTimeslotRounds = {
const db = req.db;
const roundId = req.params.roundId;

const permOK = await roundCheck(req, res, roundId);
if (!permOK) {
res.status(200).json({
error : true,
message : `You do not have permission to merge those rounds`,
});
}

try {
await db.sequelize.query(`
update
Expand Down
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ services:
image: indexcards:latest
restart: always
ports:
- 3000:3000
- 9001:3000
environment:
- NODE_ENV=production
- NODE_ENV=staging
volumes:
- /etc/tabroom/indexcards.config.js:/indexcards/config/config.js:ro
- /var/log/indexcards:/var/log/indexcards:rw
- /var/lib/GeoIP:/var/lib/GeoIP
extra_hosts:
- "host.docker.internal:host-gateway"

0 comments on commit fedf5cc

Please sign in to comment.