diff options
| author | Mohamed Bassem <me@mbassem.com> | 2025-11-17 01:42:43 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2025-11-17 01:42:43 +0000 |
| commit | 815e1961701e13c933c3975c6026c60d1ded3cdf (patch) | |
| tree | b88921d5cc37720fb3a3c1654417fce3fa0f6f02 /packages/trpc/models/rules.ts | |
| parent | 88c73e212c4510ce41ad8c6557fa7d5c8f72d199 (diff) | |
| download | karakeep-815e1961701e13c933c3975c6026c60d1ded3cdf.tar.zst | |
refactor: remove the PrivacyAware interface
Diffstat (limited to 'packages/trpc/models/rules.ts')
| -rw-r--r-- | packages/trpc/models/rules.ts | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/packages/trpc/models/rules.ts b/packages/trpc/models/rules.ts index 7b17fd8a..7d943465 100644 --- a/packages/trpc/models/rules.ts +++ b/packages/trpc/models/rules.ts @@ -17,7 +17,6 @@ import { } from "@karakeep/shared/types/rules"; import { AuthedContext } from ".."; -import { PrivacyAware } from "./privacy"; function dummy_fetchRule(ctx: AuthedContext, id: string) { return DONT_USE_DB.query.ruleEngineRulesTable.findFirst({ @@ -33,7 +32,7 @@ function dummy_fetchRule(ctx: AuthedContext, id: string) { type FetchedRuleType = NonNullable<Awaited<ReturnType<typeof dummy_fetchRule>>>; -export class RuleEngineRuleModel implements PrivacyAware { +export class RuleEngineRuleModel { protected constructor( protected ctx: AuthedContext, public rule: RuleEngineRule & { userId: string }, @@ -83,15 +82,6 @@ export class RuleEngineRuleModel implements PrivacyAware { return this.fromData(ctx, ruleData); } - ensureCanAccess(ctx: AuthedContext): void { - if (this.rule.userId != ctx.user.id) { - throw new TRPCError({ - code: "FORBIDDEN", - message: "User is not allowed to access resource", - }); - } - } - static async create( ctx: AuthedContext, input: z.infer<typeof zNewRuleEngineRuleSchema>, |
