Skip to content

Commit

Permalink
put behind read permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
nvms committed Jul 15, 2024
1 parent 0ef613c commit 440a55a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/routes/activityReports/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,17 @@ export async function getActivityRecipients(req, res) {
export async function getActivityRecipientsForExistingReport(req, res) {
const { region } = req.query;
const { activityReportId } = req.params;

const [report] = await activityReportAndRecipientsById(req.params.activityReportId);
const userId = await currentUserId(req, res);
const user = await userById(userId);
const authorization = new ActivityReport(user, report);

if (!authorization.canGet()) {
res.sendStatus(403);
return;
}

const targetRegion = parseInt(region, DECIMAL_BASE);
const activityRecipients = await possibleRecipients(targetRegion, activityReportId);
res.json(activityRecipients);
Expand Down

0 comments on commit 440a55a

Please sign in to comment.