Files
outline/server/policies/notificationSetting.ts
2022-01-06 18:24:28 -08:00

15 lines
370 B
TypeScript

import { NotificationSetting, Team, User } from "@server/models";
import { allow } from "./cancan";
allow(User, "createNotificationSetting", Team, (user, team) => {
if (!team || user.teamId !== team.id) return false;
return true;
});
allow(
User,
["read", "update", "delete"],
NotificationSetting,
(user, setting) => user && user.id === setting?.userId
);