mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-10 04:22:09 +10:00
fix: remove old requiredPerms field
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import aclManager, { type SystemACL } from "~/server/internal/acls";
|
||||
import aclManager from "~/server/internal/acls";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
@ -24,36 +24,5 @@ export default defineEventHandler(async (h3) => {
|
||||
},
|
||||
});
|
||||
|
||||
let i = notifications.length;
|
||||
while (i--) {
|
||||
const notif = notifications[i];
|
||||
|
||||
const hasPermsForNotif = await aclManager.allowSystemACL(
|
||||
h3,
|
||||
notif.requiredPerms as SystemACL,
|
||||
);
|
||||
|
||||
if (!hasPermsForNotif) {
|
||||
// remove element
|
||||
console.log(
|
||||
userId,
|
||||
"did not have perms to access",
|
||||
notif.id,
|
||||
"based on",
|
||||
notif.requiredPerms,
|
||||
);
|
||||
|
||||
notifications.splice(i, 1);
|
||||
} else {
|
||||
console.log(
|
||||
userId,
|
||||
"had perms to access",
|
||||
notif.id,
|
||||
"based on",
|
||||
notif.requiredPerms,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return notifications;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user