Skip to content

Commit 24e596d

Browse files
committed
Fix: delete registration api permisstion
1 parent e495ce6 commit 24e596d

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

back/routes/registration.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ router.post("/edit_registration", async (req, res) => {
264264
if (registration.type_id != 2) {
265265
const authorized = await checkPermission(req, res, [
266266
{ club_rep: 4, club_id: registration.club_id },
267-
// { executive: 4 },
267+
{ executive: 3 },
268268
]);
269269
if (!authorized) {
270270
return;
@@ -394,6 +394,18 @@ router.post("/edit_registration", async (req, res) => {
394394
router.post("/delete_registration", async (req, res) => {
395395
const { id } = req.query;
396396

397+
if (!registration.student_id === req.session.user.student_id) {
398+
if (registration.type_id != 2) {
399+
const authorized = await checkPermission(req, res, [
400+
{ club_rep: 4, club_id: registration.club_id },
401+
{ executive: 3 },
402+
]);
403+
if (!authorized) {
404+
return;
405+
}
406+
}
407+
}
408+
397409
const registration = await Registration.findByPk(id);
398410
if (!registration) {
399411
return res
@@ -435,6 +447,11 @@ router.post("/delete_registration", async (req, res) => {
435447
transaction,
436448
});
437449

450+
await RegistrationFeedback.destroy({
451+
where: { registration: id },
452+
transaction,
453+
});
454+
438455
// 관련 RegistrationSign 삭제
439456
await RegistrationSign.destroy({
440457
where: { registration: id },
@@ -540,7 +557,7 @@ router.get("/get_registration", async (req, res) => {
540557
if (registration.type_id != 2) {
541558
const authorized = await checkPermission(req, res, [
542559
{ club_rep: 4, club_id: registration.club_id },
543-
// { executive: 4 },
560+
{ executive: 4 },
544561
]);
545562
if (!authorized) {
546563
return;

0 commit comments

Comments
 (0)