Skip to content
This repository has been archived by the owner on Dec 27, 2024. It is now read-only.

Category creation should have permissions #311

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/calm-hairs-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@procore-oss/backstage-plugin-announcements-backend': patch
---

Adding permission checks to category creation.
4 changes: 4 additions & 0 deletions plugins/announcements-backend/src/service/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ export async function createRouter(
router.post(
'/categories',
async (req: Request<{}, {}, CategoryRequest, {}>, res) => {
if (!(await isRequestAuthorized(req, announcementCreatePermission))) {
throw new NotAllowedError('Unauthorized');
}

const category = {
...req.body,
...{
Expand Down