From aba5b2715908b37b519520527324dd560fec89ff Mon Sep 17 00:00:00 2001 From: Johann150 Date: Sun, 24 Jul 2022 11:45:37 +0200 Subject: [PATCH] remove legacy permission parsing --- packages/backend/src/server/api/endpoints/app/create.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/app/create.ts b/packages/backend/src/server/api/endpoints/app/create.ts index a0a735082..3c72699ca 100644 --- a/packages/backend/src/server/api/endpoints/app/create.ts +++ b/packages/backend/src/server/api/endpoints/app/create.ts @@ -23,6 +23,7 @@ export const paramDef = { description: { type: 'string' }, permission: { type: 'array', uniqueItems: true, items: { type: 'string', + // FIXME: add enum of possible permissions } }, callbackUrl: { type: 'string', nullable: true }, }, @@ -34,9 +35,6 @@ export default define(meta, paramDef, async (ps, user) => { // Generate secret const secret = secureRndstr(32, true); - // for backward compatibility - const permission = unique(ps.permission.map(v => v.replace(/^(.+)(\/|-)(read|write)$/, '$3:$1'))); - // Create account const app = await Apps.insert({ id: genId(), @@ -44,7 +42,7 @@ export default define(meta, paramDef, async (ps, user) => { userId: user ? user.id : null, name: ps.name, description: ps.description, - permission, + permission: ps.permission, callbackUrl: ps.callbackUrl, secret: secret, }).then(x => Apps.findOneByOrFail(x.identifiers[0]));