better-auth 1.2.6-beta.6 → 1.2.6-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/drizzle-adapter/index.d.cts +2 -2
- package/dist/adapters/drizzle-adapter/index.d.mts +2 -2
- package/dist/adapters/drizzle-adapter/index.d.ts +2 -2
- package/dist/adapters/kysely-adapter/index.d.cts +2 -2
- package/dist/adapters/kysely-adapter/index.d.mts +2 -2
- package/dist/adapters/kysely-adapter/index.d.ts +2 -2
- package/dist/adapters/memory-adapter/index.d.cts +2 -2
- package/dist/adapters/memory-adapter/index.d.mts +2 -2
- package/dist/adapters/memory-adapter/index.d.ts +2 -2
- package/dist/adapters/mongodb-adapter/index.d.cts +2 -2
- package/dist/adapters/mongodb-adapter/index.d.mts +2 -2
- package/dist/adapters/mongodb-adapter/index.d.ts +2 -2
- package/dist/adapters/prisma-adapter/index.d.cts +2 -2
- package/dist/adapters/prisma-adapter/index.d.mts +2 -2
- package/dist/adapters/prisma-adapter/index.d.ts +2 -2
- package/dist/adapters/test.d.cts +2 -2
- package/dist/adapters/test.d.mts +2 -2
- package/dist/adapters/test.d.ts +2 -2
- package/dist/api/index.cjs +1 -1
- package/dist/api/index.d.cts +2 -2
- package/dist/api/index.d.mts +2 -2
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.mjs +1 -1
- package/dist/chunks/server.cjs +905 -0
- package/dist/chunks/server.mjs +895 -0
- package/dist/client/index.d.cts +2 -2
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/plugins/index.cjs +20 -12
- package/dist/client/plugins/index.d.cts +3 -3
- package/dist/client/plugins/index.d.mts +3 -3
- package/dist/client/plugins/index.d.ts +3 -3
- package/dist/client/plugins/index.mjs +20 -12
- package/dist/client/react/index.cjs +4 -4
- package/dist/client/react/index.d.cts +2 -2
- package/dist/client/react/index.d.mts +2 -2
- package/dist/client/react/index.d.ts +2 -2
- package/dist/client/solid/index.d.cts +2 -2
- package/dist/client/solid/index.d.mts +2 -2
- package/dist/client/solid/index.d.ts +2 -2
- package/dist/client/svelte/index.d.cts +2 -2
- package/dist/client/svelte/index.d.mts +2 -2
- package/dist/client/svelte/index.d.ts +2 -2
- package/dist/client/vue/index.d.cts +2 -2
- package/dist/client/vue/index.d.mts +2 -2
- package/dist/client/vue/index.d.ts +2 -2
- package/dist/cookies/index.d.cts +2 -2
- package/dist/cookies/index.d.mts +2 -2
- package/dist/cookies/index.d.ts +2 -2
- package/dist/db/index.cjs +2 -2
- package/dist/db/index.d.cts +3 -3
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.d.ts +3 -3
- package/dist/db/index.mjs +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/integrations/next-js.cjs +2 -1
- package/dist/integrations/next-js.d.cts +2 -2
- package/dist/integrations/next-js.d.mts +2 -2
- package/dist/integrations/next-js.d.ts +2 -2
- package/dist/integrations/next-js.mjs +2 -1
- package/dist/integrations/node.d.cts +2 -2
- package/dist/integrations/node.d.mts +2 -2
- package/dist/integrations/node.d.ts +2 -2
- package/dist/integrations/react-start.cjs +90 -0
- package/dist/integrations/react-start.d.cts +20 -0
- package/dist/integrations/react-start.d.mts +20 -0
- package/dist/integrations/react-start.d.ts +20 -0
- package/dist/integrations/react-start.mjs +88 -0
- package/dist/integrations/svelte-kit.d.cts +2 -2
- package/dist/integrations/svelte-kit.d.mts +2 -2
- package/dist/integrations/svelte-kit.d.ts +2 -2
- package/dist/oauth2/index.d.cts +4 -4
- package/dist/oauth2/index.d.mts +4 -4
- package/dist/oauth2/index.d.ts +4 -4
- package/dist/plugins/admin/index.cjs +2 -1
- package/dist/plugins/admin/index.d.cts +2 -2
- package/dist/plugins/admin/index.d.mts +2 -2
- package/dist/plugins/admin/index.d.ts +2 -2
- package/dist/plugins/admin/index.mjs +2 -1
- package/dist/plugins/anonymous/index.d.cts +2 -2
- package/dist/plugins/anonymous/index.d.mts +2 -2
- package/dist/plugins/anonymous/index.d.ts +2 -2
- package/dist/plugins/bearer/index.d.cts +2 -2
- package/dist/plugins/bearer/index.d.mts +2 -2
- package/dist/plugins/bearer/index.d.ts +2 -2
- package/dist/plugins/custom-session/index.d.cts +2 -2
- package/dist/plugins/custom-session/index.d.mts +2 -2
- package/dist/plugins/custom-session/index.d.ts +2 -2
- package/dist/plugins/email-otp/index.d.cts +2 -2
- package/dist/plugins/email-otp/index.d.mts +2 -2
- package/dist/plugins/email-otp/index.d.ts +2 -2
- package/dist/plugins/generic-oauth/index.cjs +6 -3
- package/dist/plugins/generic-oauth/index.d.cts +2 -2
- package/dist/plugins/generic-oauth/index.d.mts +2 -2
- package/dist/plugins/generic-oauth/index.d.ts +2 -2
- package/dist/plugins/generic-oauth/index.mjs +6 -3
- package/dist/plugins/index.cjs +5 -3
- package/dist/plugins/index.d.cts +3 -3
- package/dist/plugins/index.d.mts +3 -3
- package/dist/plugins/index.d.ts +3 -3
- package/dist/plugins/index.mjs +5 -3
- package/dist/plugins/jwt/index.d.cts +2 -2
- package/dist/plugins/jwt/index.d.mts +2 -2
- package/dist/plugins/jwt/index.d.ts +2 -2
- package/dist/plugins/multi-session/index.d.cts +2 -2
- package/dist/plugins/multi-session/index.d.mts +2 -2
- package/dist/plugins/multi-session/index.d.ts +2 -2
- package/dist/plugins/oauth-proxy/index.d.cts +2 -2
- package/dist/plugins/oauth-proxy/index.d.mts +2 -2
- package/dist/plugins/oauth-proxy/index.d.ts +2 -2
- package/dist/plugins/oidc-provider/index.d.cts +2 -2
- package/dist/plugins/oidc-provider/index.d.mts +2 -2
- package/dist/plugins/oidc-provider/index.d.ts +2 -2
- package/dist/plugins/open-api/index.cjs +1 -1
- package/dist/plugins/open-api/index.d.cts +2 -2
- package/dist/plugins/open-api/index.d.mts +2 -2
- package/dist/plugins/open-api/index.d.ts +2 -2
- package/dist/plugins/open-api/index.mjs +1 -1
- package/dist/plugins/organization/index.cjs +2 -1
- package/dist/plugins/organization/index.d.cts +2 -2
- package/dist/plugins/organization/index.d.mts +2 -2
- package/dist/plugins/organization/index.d.ts +2 -2
- package/dist/plugins/organization/index.mjs +2 -1
- package/dist/plugins/passkey/index.d.cts +2 -2
- package/dist/plugins/passkey/index.d.mts +2 -2
- package/dist/plugins/passkey/index.d.ts +2 -2
- package/dist/plugins/phone-number/index.d.cts +2 -2
- package/dist/plugins/phone-number/index.d.mts +2 -2
- package/dist/plugins/phone-number/index.d.ts +2 -2
- package/dist/plugins/sso/index.d.cts +2 -2
- package/dist/plugins/sso/index.d.mts +2 -2
- package/dist/plugins/sso/index.d.ts +2 -2
- package/dist/plugins/two-factor/index.d.cts +2 -2
- package/dist/plugins/two-factor/index.d.mts +2 -2
- package/dist/plugins/two-factor/index.d.ts +2 -2
- package/dist/plugins/username/index.d.cts +2 -2
- package/dist/plugins/username/index.d.mts +2 -2
- package/dist/plugins/username/index.d.ts +2 -2
- package/dist/shared/{better-auth.Dmtp4RCi.mjs → better-auth.A3TjrU8G.mjs} +1 -1
- package/dist/shared/{better-auth.DpnaS1Ry.d.cts → better-auth.B2Fw1vhH.d.cts} +2 -4
- package/dist/shared/{better-auth.Cr5ixZZK.d.ts → better-auth.BANAxdkL.d.ts} +2 -4
- package/dist/shared/{better-auth.BGUZBbM4.cjs → better-auth.BIjcZ_vt.cjs} +1 -1
- package/dist/shared/{better-auth.2p1C52nv.d.ts → better-auth.BRf6Iynu.d.ts} +1 -1
- package/dist/shared/{better-auth.i9-25Ul9.cjs → better-auth.BSsp73pg.cjs} +1 -1
- package/dist/shared/{better-auth.CvCI1gIa.d.ts → better-auth.BWp5dztg.d.ts} +1 -1
- package/dist/shared/{better-auth.BArzzn5a.d.cts → better-auth.BiQsvaIP.d.cts} +2 -2
- package/dist/shared/{better-auth.DZGc_87_.mjs → better-auth.BrOpzmqo.mjs} +1 -1
- package/dist/shared/better-auth.CApEjVDP.cjs +21 -0
- package/dist/shared/{better-auth.CN1HkXUY.cjs → better-auth.CV1L7TPV.cjs} +25 -43
- package/dist/shared/{better-auth.CPKJJalM.cjs → better-auth.CsSpq0zL.cjs} +13 -29
- package/dist/shared/{better-auth.DCCen_rd.d.mts → better-auth.D-oLmHIj.d.mts} +2 -2
- package/dist/shared/{better-auth.CmHTEIYA.mjs → better-auth.D9VnBkRI.mjs} +1 -17
- package/dist/shared/better-auth.DLTzKoOS.cjs +18 -0
- package/dist/shared/{better-auth.CFzfx-2c.mjs → better-auth.DPBQN9Fs.mjs} +16 -34
- package/dist/shared/{better-auth.CouMuYtz.d.ts → better-auth.DU2QNVc_.d.ts} +2 -2
- package/dist/shared/{better-auth.C5A8Vzv0.d.cts → better-auth.DWRligF8.d.cts} +1 -1
- package/dist/shared/better-auth.DiG4KL2x.mjs +16 -0
- package/dist/shared/{better-auth.Dy54W_9o.d.cts → better-auth.Dmhe30iW.d.mts} +1 -1
- package/dist/shared/{better-auth.YLWLGLEW.d.mts → better-auth.DtC8i3pf.d.cts} +1 -1
- package/dist/shared/{better-auth.-kZ-JqcP.d.mts → better-auth.bKwabe3I.d.mts} +2 -4
- package/dist/shared/better-auth.cOCrlspr.mjs +19 -0
- package/dist/shared/{better-auth.BDKSU3Dg.d.mts → better-auth.wcdMj2cT.d.mts} +1 -1
- package/dist/social-providers/index.cjs +13 -4
- package/dist/social-providers/index.d.cts +1 -1
- package/dist/social-providers/index.d.mts +1 -1
- package/dist/social-providers/index.d.ts +1 -1
- package/dist/social-providers/index.mjs +13 -4
- package/dist/types/index.d.cts +3 -4
- package/dist/types/index.d.mts +3 -4
- package/dist/types/index.d.ts +3 -4
- package/package.json +15 -1
|
@@ -2,9 +2,9 @@ import * as _simplewebauthn_server from '@simplewebauthn/server';
|
|
|
2
2
|
import { CredentialDeviceType, PublicKeyCredentialCreationOptionsJSON, AuthenticationResponseJSON } from '@simplewebauthn/server';
|
|
3
3
|
import * as better_call from 'better-call';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { I as InferOptionSchema } from '../../shared/better-auth.
|
|
5
|
+
import { I as InferOptionSchema } from '../../shared/better-auth.DU2QNVc_.js';
|
|
6
6
|
import '../../shared/better-auth.Bi8FQwDD.js';
|
|
7
|
-
import '../../shared/better-auth.
|
|
7
|
+
import '../../shared/better-auth.BANAxdkL.js';
|
|
8
8
|
import 'jose';
|
|
9
9
|
import 'kysely';
|
|
10
10
|
import 'better-sqlite3';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as better_call from 'better-call';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { U as User, I as InferOptionSchema } from '../../shared/better-auth.
|
|
3
|
+
import { U as User, I as InferOptionSchema } from '../../shared/better-auth.BiQsvaIP.cjs';
|
|
4
4
|
import '../../shared/better-auth.Bi8FQwDD.cjs';
|
|
5
|
-
import '../../shared/better-auth.
|
|
5
|
+
import '../../shared/better-auth.B2Fw1vhH.cjs';
|
|
6
6
|
import 'jose';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import 'better-sqlite3';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as better_call from 'better-call';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { U as User, I as InferOptionSchema } from '../../shared/better-auth.
|
|
3
|
+
import { U as User, I as InferOptionSchema } from '../../shared/better-auth.D-oLmHIj.mjs';
|
|
4
4
|
import '../../shared/better-auth.Bi8FQwDD.mjs';
|
|
5
|
-
import '../../shared/better-auth
|
|
5
|
+
import '../../shared/better-auth.bKwabe3I.mjs';
|
|
6
6
|
import 'jose';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import 'better-sqlite3';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as better_call from 'better-call';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { U as User, I as InferOptionSchema } from '../../shared/better-auth.
|
|
3
|
+
import { U as User, I as InferOptionSchema } from '../../shared/better-auth.DU2QNVc_.js';
|
|
4
4
|
import '../../shared/better-auth.Bi8FQwDD.js';
|
|
5
|
-
import '../../shared/better-auth.
|
|
5
|
+
import '../../shared/better-auth.BANAxdkL.js';
|
|
6
6
|
import 'jose';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import 'better-sqlite3';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as better_call from 'better-call';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { O as OAuth2Tokens } from '../../shared/better-auth.
|
|
4
|
-
import { U as User } from '../../shared/better-auth.
|
|
3
|
+
import { O as OAuth2Tokens } from '../../shared/better-auth.B2Fw1vhH.cjs';
|
|
4
|
+
import { U as User } from '../../shared/better-auth.BiQsvaIP.cjs';
|
|
5
5
|
import '../../shared/better-auth.Bi8FQwDD.cjs';
|
|
6
6
|
import 'jose';
|
|
7
7
|
import 'kysely';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as better_call from 'better-call';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { O as OAuth2Tokens } from '../../shared/better-auth
|
|
4
|
-
import { U as User } from '../../shared/better-auth.
|
|
3
|
+
import { O as OAuth2Tokens } from '../../shared/better-auth.bKwabe3I.mjs';
|
|
4
|
+
import { U as User } from '../../shared/better-auth.D-oLmHIj.mjs';
|
|
5
5
|
import '../../shared/better-auth.Bi8FQwDD.mjs';
|
|
6
6
|
import 'jose';
|
|
7
7
|
import 'kysely';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as better_call from 'better-call';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { O as OAuth2Tokens } from '../../shared/better-auth.
|
|
4
|
-
import { U as User } from '../../shared/better-auth.
|
|
3
|
+
import { O as OAuth2Tokens } from '../../shared/better-auth.BANAxdkL.js';
|
|
4
|
+
import { U as User } from '../../shared/better-auth.DU2QNVc_.js';
|
|
5
5
|
import '../../shared/better-auth.Bi8FQwDD.js';
|
|
6
6
|
import 'jose';
|
|
7
7
|
import 'kysely';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
|
-
import { U as User, I as InferOptionSchema, d as AuthEndpoint, S as Session, G as GenericEndpointContext, H as HookEndpointContext } from '../../shared/better-auth.
|
|
3
|
+
import { U as User, I as InferOptionSchema, d as AuthEndpoint, S as Session, G as GenericEndpointContext, H as HookEndpointContext } from '../../shared/better-auth.BiQsvaIP.cjs';
|
|
4
4
|
import { L as LiteralString } from '../../shared/better-auth.Bi8FQwDD.cjs';
|
|
5
5
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
6
|
-
import '../../shared/better-auth.
|
|
6
|
+
import '../../shared/better-auth.B2Fw1vhH.cjs';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import 'kysely';
|
|
9
9
|
import 'better-sqlite3';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
|
-
import { U as User, I as InferOptionSchema, d as AuthEndpoint, S as Session, G as GenericEndpointContext, H as HookEndpointContext } from '../../shared/better-auth.
|
|
3
|
+
import { U as User, I as InferOptionSchema, d as AuthEndpoint, S as Session, G as GenericEndpointContext, H as HookEndpointContext } from '../../shared/better-auth.D-oLmHIj.mjs';
|
|
4
4
|
import { L as LiteralString } from '../../shared/better-auth.Bi8FQwDD.mjs';
|
|
5
5
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
6
|
-
import '../../shared/better-auth
|
|
6
|
+
import '../../shared/better-auth.bKwabe3I.mjs';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import 'kysely';
|
|
9
9
|
import 'better-sqlite3';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
|
-
import { U as User, I as InferOptionSchema, d as AuthEndpoint, S as Session, G as GenericEndpointContext, H as HookEndpointContext } from '../../shared/better-auth.
|
|
3
|
+
import { U as User, I as InferOptionSchema, d as AuthEndpoint, S as Session, G as GenericEndpointContext, H as HookEndpointContext } from '../../shared/better-auth.DU2QNVc_.js';
|
|
4
4
|
import { L as LiteralString } from '../../shared/better-auth.Bi8FQwDD.js';
|
|
5
5
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
6
|
-
import '../../shared/better-auth.
|
|
6
|
+
import '../../shared/better-auth.BANAxdkL.js';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import 'kysely';
|
|
9
9
|
import 'better-sqlite3';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
|
-
import { I as InferOptionSchema, H as HookEndpointContext } from '../../shared/better-auth.
|
|
3
|
+
import { I as InferOptionSchema, H as HookEndpointContext } from '../../shared/better-auth.BiQsvaIP.cjs';
|
|
4
4
|
import '../../shared/better-auth.Bi8FQwDD.cjs';
|
|
5
|
-
import '../../shared/better-auth.
|
|
5
|
+
import '../../shared/better-auth.B2Fw1vhH.cjs';
|
|
6
6
|
import 'jose';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import 'better-sqlite3';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
|
-
import { I as InferOptionSchema, H as HookEndpointContext } from '../../shared/better-auth.
|
|
3
|
+
import { I as InferOptionSchema, H as HookEndpointContext } from '../../shared/better-auth.D-oLmHIj.mjs';
|
|
4
4
|
import '../../shared/better-auth.Bi8FQwDD.mjs';
|
|
5
|
-
import '../../shared/better-auth
|
|
5
|
+
import '../../shared/better-auth.bKwabe3I.mjs';
|
|
6
6
|
import 'jose';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import 'better-sqlite3';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
|
-
import { I as InferOptionSchema, H as HookEndpointContext } from '../../shared/better-auth.
|
|
3
|
+
import { I as InferOptionSchema, H as HookEndpointContext } from '../../shared/better-auth.DU2QNVc_.js';
|
|
4
4
|
import '../../shared/better-auth.Bi8FQwDD.js';
|
|
5
|
-
import '../../shared/better-auth.
|
|
5
|
+
import '../../shared/better-auth.BANAxdkL.js';
|
|
6
6
|
import 'jose';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import 'better-sqlite3';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { g as getDate } from './better-auth.CW6D9eSx.mjs';
|
|
2
2
|
import { d as parseSessionOutput, b as parseUserOutput } from './better-auth.CepcSj5H.mjs';
|
|
3
|
-
import { g as getIp } from './better-auth.
|
|
3
|
+
import { g as getIp } from './better-auth.BrOpzmqo.mjs';
|
|
4
4
|
import { s as safeJSONParse } from './better-auth.tB5eU6EY.mjs';
|
|
5
5
|
import { g as generateId } from './better-auth.BUPPRXfK.mjs';
|
|
6
6
|
import 'zod';
|
|
@@ -689,7 +689,7 @@ interface TwitterProfile {
|
|
|
689
689
|
id: string;
|
|
690
690
|
/** The friendly name of this user, as shown on their profile. */
|
|
691
691
|
name: string;
|
|
692
|
-
/**
|
|
692
|
+
/** The email address of this user. */
|
|
693
693
|
email?: string;
|
|
694
694
|
/** The Twitter handle (screen name) of this user. */
|
|
695
695
|
username: string;
|
|
@@ -792,9 +792,7 @@ declare const twitter: (options: TwitterOption) => {
|
|
|
792
792
|
user: {
|
|
793
793
|
id: string;
|
|
794
794
|
name?: string;
|
|
795
|
-
email
|
|
796
|
-
/** The URL to the profile image for this user, as shown on the user's profile. */
|
|
797
|
-
? /** The URL to the profile image for this user, as shown on the user's profile. */: string | null;
|
|
795
|
+
email?: string | null;
|
|
798
796
|
image?: string;
|
|
799
797
|
emailVerified: boolean;
|
|
800
798
|
[key: string]: any;
|
|
@@ -689,7 +689,7 @@ interface TwitterProfile {
|
|
|
689
689
|
id: string;
|
|
690
690
|
/** The friendly name of this user, as shown on their profile. */
|
|
691
691
|
name: string;
|
|
692
|
-
/**
|
|
692
|
+
/** The email address of this user. */
|
|
693
693
|
email?: string;
|
|
694
694
|
/** The Twitter handle (screen name) of this user. */
|
|
695
695
|
username: string;
|
|
@@ -792,9 +792,7 @@ declare const twitter: (options: TwitterOption) => {
|
|
|
792
792
|
user: {
|
|
793
793
|
id: string;
|
|
794
794
|
name?: string;
|
|
795
|
-
email
|
|
796
|
-
/** The URL to the profile image for this user, as shown on the user's profile. */
|
|
797
|
-
? /** The URL to the profile image for this user, as shown on the user's profile. */: string | null;
|
|
795
|
+
email?: string | null;
|
|
798
796
|
image?: string;
|
|
799
797
|
emailVerified: boolean;
|
|
800
798
|
[key: string]: any;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const date = require('./better-auth.C1hdVENX.cjs');
|
|
4
4
|
const schema = require('./better-auth.C5H9XEzZ.cjs');
|
|
5
|
-
const getRequestIp = require('./better-auth.
|
|
5
|
+
const getRequestIp = require('./better-auth.BSsp73pg.cjs');
|
|
6
6
|
const json = require('./better-auth.D3mtHEZg.cjs');
|
|
7
7
|
const id = require('./better-auth.Bg6iw3ig.cjs');
|
|
8
8
|
require('zod');
|
|
@@ -24,7 +24,7 @@ function getIp(req, options) {
|
|
|
24
24
|
];
|
|
25
25
|
const headers = "headers" in req ? req.headers : req;
|
|
26
26
|
for (const key of keys) {
|
|
27
|
-
const value = headers.get(key);
|
|
27
|
+
const value = "get" in headers ? headers.get(key) : headers[key];
|
|
28
28
|
if (typeof value === "string") {
|
|
29
29
|
const ip = value.split(",")[0].trim();
|
|
30
30
|
if (ip) return ip;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
|
-
import { G as GenericEndpointContext, I as InferOptionSchema, H as HookEndpointContext,
|
|
3
|
+
import { G as GenericEndpointContext, I as InferOptionSchema, H as HookEndpointContext, j as AuthContext } from './better-auth.DU2QNVc_.js';
|
|
4
4
|
import { Statements } from '../plugins/access/index.js';
|
|
5
5
|
|
|
6
6
|
declare const apiKeySchema: ({ timeWindow, rateLimitMax, }: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { L as LiteralString, d as LiteralUnion, D as DeepPartial, U as UnionToIntersection, S as StripEmptyObjects, O as OmitId, P as PrettifyDeep, b as Prettify, E as Expand } from './better-auth.Bi8FQwDD.cjs';
|
|
2
2
|
import * as zod from 'zod';
|
|
3
3
|
import { ZodSchema, z } from 'zod';
|
|
4
|
-
import { a as OAuthProvider, S as SocialProviders, b as SocialProviderList, O as OAuth2Tokens } from './better-auth.
|
|
4
|
+
import { a as OAuthProvider, S as SocialProviders, b as SocialProviderList, O as OAuth2Tokens } from './better-auth.B2Fw1vhH.cjs';
|
|
5
5
|
import { Migration, PostgresPool, MysqlPool, Dialect, Kysely } from 'kysely';
|
|
6
6
|
import * as better_call from 'better-call';
|
|
7
7
|
import { EndpointContext, InputContext, CookieOptions, Endpoint, Middleware } from 'better-call';
|
|
@@ -14264,4 +14264,4 @@ type Auth = {
|
|
|
14264
14264
|
$context: Promise<AuthContext>;
|
|
14265
14265
|
};
|
|
14266
14266
|
|
|
14267
|
-
export { createFieldAttribute as $, type AuthPluginSchema as A, type BetterAuthPlugin as B, type InferSessionAPI as C, type InferAPI as D, levels as E, type FilteredAPI as F, type GenericEndpointContext as G, type HookEndpointContext as H, type InferOptionSchema as I, shouldPublishLog as J, type KyselyDatabaseType as K, type LogLevel as L, type Models as M, type Logger as N, type LogHandlerParams as O, createLogger as P, logger as Q, type RateLimit as R, type Session as S, type FieldAttribute as T, type User as U, type Verification as V, type Where as W, type FieldType as X, createInternalAdapter as Y, type InternalAdapter as Z, type FieldAttributeConfig as _, type InferPluginErrorCodes as a, changeEmail as a$, type InferValueType as a0, type InferFieldsOutput as a1, type InferFieldsInput as a2, type InferFieldsInputClient as a3, type PluginFieldAttribute as a4, type InferFieldsFromPlugins as a5, type InferFieldsFromOptions as a6, type BetterAuthDbSchema as a7, getAuthTables as a8, accountSchema as a9, getEndpoints as aA, router as aB, signInSocial as aC, signInEmail as aD, callbackOAuth as aE, getSession as aF, getSessionFromCtx as aG, sessionMiddleware as aH, requestOnlySessionMiddleware as aI, freshSessionMiddleware as aJ, listSessions as aK, revokeSession as aL, revokeSessions as aM, revokeOtherSessions as aN, signOut as aO, forgetPassword as aP, forgetPasswordCallback as aQ, resetPassword as aR, createEmailVerificationToken as aS, sendVerificationEmailFn as aT, sendVerificationEmail as aU, verifyEmail as aV, updateUser as aW, changePassword as aX, setPassword as aY, deleteUser as aZ, deleteUserCallback as a_, userSchema as aa, sessionSchema as ab, verificationSchema as ac, parseOutputData as ad, getAllFields as ae, parseUserOutput as af, parseAccountOutput as ag, parseSessionOutput as ah, parseInputData as ai, parseUserInput as aj, parseAdditionalUserInput as ak, parseAccountInput as al, parseSessionInput as am, mergeSchema as an, createCookieGetter as ao, getCookies as ap, type BetterAuthCookies as aq, setCookieCache as ar, setSessionCookie as as, deleteSessionCookie as at, parseCookies as au, type EligibleCookies as av, getSessionCookie as aw, getCookieCache as ax, parseSetCookieHeader as ay, setCookieToHeader as az, createAuthEndpoint as b, error as b0, ok as b1, signUpEmail as b2, listUserAccounts as b3, linkSocialAccount as b4, unlinkAccount as b5, refreshToken as b6, originCheckMiddleware as b7, originCheck as b8, createAuthMiddleware as c, type AuthEndpoint as d, type AuthMiddleware as e, type BetterAuthOptions as f, type Adapter as g, BASE_ERROR_CODES as h, type Auth as i, type
|
|
14267
|
+
export { createFieldAttribute as $, type AuthPluginSchema as A, type BetterAuthPlugin as B, type InferSessionAPI as C, type InferAPI as D, levels as E, type FilteredAPI as F, type GenericEndpointContext as G, type HookEndpointContext as H, type InferOptionSchema as I, shouldPublishLog as J, type KyselyDatabaseType as K, type LogLevel as L, type Models as M, type Logger as N, type LogHandlerParams as O, createLogger as P, logger as Q, type RateLimit as R, type Session as S, type FieldAttribute as T, type User as U, type Verification as V, type Where as W, type FieldType as X, createInternalAdapter as Y, type InternalAdapter as Z, type FieldAttributeConfig as _, type InferPluginErrorCodes as a, changeEmail as a$, type InferValueType as a0, type InferFieldsOutput as a1, type InferFieldsInput as a2, type InferFieldsInputClient as a3, type PluginFieldAttribute as a4, type InferFieldsFromPlugins as a5, type InferFieldsFromOptions as a6, type BetterAuthDbSchema as a7, getAuthTables as a8, accountSchema as a9, getEndpoints as aA, router as aB, signInSocial as aC, signInEmail as aD, callbackOAuth as aE, getSession as aF, getSessionFromCtx as aG, sessionMiddleware as aH, requestOnlySessionMiddleware as aI, freshSessionMiddleware as aJ, listSessions as aK, revokeSession as aL, revokeSessions as aM, revokeOtherSessions as aN, signOut as aO, forgetPassword as aP, forgetPasswordCallback as aQ, resetPassword as aR, createEmailVerificationToken as aS, sendVerificationEmailFn as aT, sendVerificationEmail as aU, verifyEmail as aV, updateUser as aW, changePassword as aX, setPassword as aY, deleteUser as aZ, deleteUserCallback as a_, userSchema as aa, sessionSchema as ab, verificationSchema as ac, parseOutputData as ad, getAllFields as ae, parseUserOutput as af, parseAccountOutput as ag, parseSessionOutput as ah, parseInputData as ai, parseUserInput as aj, parseAdditionalUserInput as ak, parseAccountInput as al, parseSessionInput as am, mergeSchema as an, createCookieGetter as ao, getCookies as ap, type BetterAuthCookies as aq, setCookieCache as ar, setSessionCookie as as, deleteSessionCookie as at, parseCookies as au, type EligibleCookies as av, getSessionCookie as aw, getCookieCache as ax, parseSetCookieHeader as ay, setCookieToHeader as az, createAuthEndpoint as b, error as b0, ok as b1, signUpEmail as b2, listUserAccounts as b3, linkSocialAccount as b4, unlinkAccount as b5, refreshToken as b6, originCheckMiddleware as b7, originCheck as b8, createAuthMiddleware as c, type AuthEndpoint as d, type AuthMiddleware as e, type BetterAuthOptions as f, type Adapter as g, BASE_ERROR_CODES as h, type Auth as i, type AuthContext as j, type InferUser as k, type InferSession as l, type WithJsDoc as m, betterAuth as n, optionsMiddleware as o, type AdditionalUserFieldsInput as p, type AdditionalUserFieldsOutput as q, type AdditionalSessionFieldsInput as r, type AdditionalSessionFieldsOutput as s, type InferPluginTypes as t, type Account as u, init as v, type AdapterSchemaCreation as w, type AdapterInstance as x, type SecondaryStorage as y, type FilterActions as z };
|
|
@@ -22,7 +22,7 @@ function getIp(req, options) {
|
|
|
22
22
|
];
|
|
23
23
|
const headers = "headers" in req ? req.headers : req;
|
|
24
24
|
for (const key of keys) {
|
|
25
|
-
const value = headers.get(key);
|
|
25
|
+
const value = "get" in headers ? headers.get(key) : headers[key];
|
|
26
26
|
if (typeof value === "string") {
|
|
27
27
|
const ip = value.split(",")[0].trim();
|
|
28
28
|
if (ip) return ip;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const plugins_admin_access_index = require('../plugins/admin/access/index.cjs');
|
|
4
|
+
|
|
5
|
+
const hasPermission = (input) => {
|
|
6
|
+
if (input.userId && input.options?.adminUserIds?.includes(input.userId)) {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
const roles = (input.role || input.options?.defaultRole || "user").split(",");
|
|
10
|
+
const acRoles = input.options?.roles || plugins_admin_access_index.defaultRoles;
|
|
11
|
+
for (const role of roles) {
|
|
12
|
+
const _role = acRoles[role];
|
|
13
|
+
const result = _role?.authorize(input.permission);
|
|
14
|
+
if (result?.success) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.hasPermission = hasPermission;
|
|
@@ -23,8 +23,9 @@ require('@better-auth/utils');
|
|
|
23
23
|
require('@better-auth/utils/hex');
|
|
24
24
|
require('@noble/hashes/utils');
|
|
25
25
|
require('./better-auth.CYeOI8C-.cjs');
|
|
26
|
-
const
|
|
26
|
+
const hasPermission = require('./better-auth.DLTzKoOS.cjs');
|
|
27
27
|
const cookies_index = require('../cookies/index.cjs');
|
|
28
|
+
const plugins_organization_access_index = require('../plugins/organization/access/index.cjs');
|
|
28
29
|
|
|
29
30
|
const shimContext = (originalObject, newContext) => {
|
|
30
31
|
const shimmedObj = {};
|
|
@@ -642,19 +643,6 @@ const ORGANIZATION_ERROR_CODES = {
|
|
|
642
643
|
YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM: "You are not allowed to update this team"
|
|
643
644
|
};
|
|
644
645
|
|
|
645
|
-
const hasPermission = (input) => {
|
|
646
|
-
const roles = input.role.split(",");
|
|
647
|
-
const acRoles = input.options.roles || plugins_organization_access_index.defaultRoles;
|
|
648
|
-
for (const role of roles) {
|
|
649
|
-
const _role = acRoles[role];
|
|
650
|
-
const result = _role?.authorize(input.permission);
|
|
651
|
-
if (result?.success) {
|
|
652
|
-
return true;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
return false;
|
|
656
|
-
};
|
|
657
|
-
|
|
658
646
|
const createInvitation = (option) => refreshToken.createAuthEndpoint(
|
|
659
647
|
"/organization/invite-member",
|
|
660
648
|
{
|
|
@@ -763,7 +751,7 @@ const createInvitation = (option) => refreshToken.createAuthEndpoint(
|
|
|
763
751
|
message: ORGANIZATION_ERROR_CODES.MEMBER_NOT_FOUND
|
|
764
752
|
});
|
|
765
753
|
}
|
|
766
|
-
const canInvite = hasPermission({
|
|
754
|
+
const canInvite = hasPermission.hasPermission({
|
|
767
755
|
role: member.role,
|
|
768
756
|
options: ctx.context.orgOptions,
|
|
769
757
|
permission: {
|
|
@@ -1038,7 +1026,7 @@ const cancelInvitation = refreshToken.createAuthEndpoint(
|
|
|
1038
1026
|
message: ORGANIZATION_ERROR_CODES.MEMBER_NOT_FOUND
|
|
1039
1027
|
});
|
|
1040
1028
|
}
|
|
1041
|
-
const canCancel = hasPermission({
|
|
1029
|
+
const canCancel = hasPermission.hasPermission({
|
|
1042
1030
|
role: member.role,
|
|
1043
1031
|
options: ctx.context.orgOptions,
|
|
1044
1032
|
permission: {
|
|
@@ -1349,12 +1337,6 @@ const removeMember = refreshToken.createAuthEndpoint(
|
|
|
1349
1337
|
message: ORGANIZATION_ERROR_CODES.MEMBER_NOT_FOUND
|
|
1350
1338
|
});
|
|
1351
1339
|
}
|
|
1352
|
-
const role = ctx.context.roles[member.role];
|
|
1353
|
-
if (!role) {
|
|
1354
|
-
throw new betterCall.APIError("BAD_REQUEST", {
|
|
1355
|
-
message: ORGANIZATION_ERROR_CODES.ROLE_NOT_FOUND
|
|
1356
|
-
});
|
|
1357
|
-
}
|
|
1358
1340
|
const roles = toBeRemovedMember.role.split(",");
|
|
1359
1341
|
const creatorRole = ctx.context.orgOptions?.creatorRole || "owner";
|
|
1360
1342
|
const isOwner = roles.includes(creatorRole);
|
|
@@ -1377,7 +1359,7 @@ const removeMember = refreshToken.createAuthEndpoint(
|
|
|
1377
1359
|
});
|
|
1378
1360
|
}
|
|
1379
1361
|
}
|
|
1380
|
-
const canDeleteMember = hasPermission({
|
|
1362
|
+
const canDeleteMember = hasPermission.hasPermission({
|
|
1381
1363
|
role: member.role,
|
|
1382
1364
|
options: ctx.context.orgOptions,
|
|
1383
1365
|
permission: {
|
|
@@ -1457,6 +1439,9 @@ const updateMemberRole = (option) => refreshToken.createAuthEndpoint(
|
|
|
1457
1439
|
},
|
|
1458
1440
|
async (ctx) => {
|
|
1459
1441
|
const session = ctx.context.session;
|
|
1442
|
+
if (!ctx.body.role) {
|
|
1443
|
+
throw new betterCall.APIError("BAD_REQUEST");
|
|
1444
|
+
}
|
|
1460
1445
|
const organizationId = ctx.body.organizationId || session.session.activeOrganizationId;
|
|
1461
1446
|
if (!organizationId) {
|
|
1462
1447
|
throw new betterCall.APIError("BAD_REQUEST", {
|
|
@@ -1474,35 +1459,32 @@ const updateMemberRole = (option) => refreshToken.createAuthEndpoint(
|
|
|
1474
1459
|
message: ORGANIZATION_ERROR_CODES.MEMBER_NOT_FOUND
|
|
1475
1460
|
});
|
|
1476
1461
|
}
|
|
1477
|
-
const toBeUpdatedMember = member.
|
|
1462
|
+
const toBeUpdatedMember = member.id !== ctx.body.memberId ? await adapter.findMemberById(ctx.body.memberId) : member;
|
|
1478
1463
|
if (!toBeUpdatedMember) {
|
|
1479
1464
|
throw new betterCall.APIError("BAD_REQUEST", {
|
|
1480
1465
|
message: ORGANIZATION_ERROR_CODES.MEMBER_NOT_FOUND
|
|
1481
1466
|
});
|
|
1482
1467
|
}
|
|
1483
|
-
const
|
|
1484
|
-
|
|
1485
|
-
throw new betterCall.APIError("BAD_REQUEST", {
|
|
1486
|
-
message: ORGANIZATION_ERROR_CODES.ROLE_NOT_FOUND
|
|
1487
|
-
});
|
|
1488
|
-
}
|
|
1468
|
+
const toBeUpdatedMemberRoles = toBeUpdatedMember.role.split(",");
|
|
1469
|
+
const updatingMemberRoles = member.role.split(",");
|
|
1489
1470
|
const creatorRole = ctx.context.orgOptions?.creatorRole || "owner";
|
|
1490
|
-
if (
|
|
1471
|
+
if (toBeUpdatedMemberRoles.includes(creatorRole) && !updatingMemberRoles.includes(creatorRole) || roleToSet.includes(creatorRole) && !updatingMemberRoles.includes(creatorRole)) {
|
|
1491
1472
|
throw new betterCall.APIError("FORBIDDEN", {
|
|
1492
1473
|
message: ORGANIZATION_ERROR_CODES.YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER
|
|
1493
1474
|
});
|
|
1494
1475
|
}
|
|
1495
|
-
const canUpdateMember =
|
|
1496
|
-
|
|
1497
|
-
|
|
1476
|
+
const canUpdateMember = hasPermission.hasPermission({
|
|
1477
|
+
role: member.role,
|
|
1478
|
+
options: ctx.context.orgOptions,
|
|
1479
|
+
permission: {
|
|
1480
|
+
member: ["update"]
|
|
1481
|
+
}
|
|
1482
|
+
});
|
|
1498
1483
|
if (!canUpdateMember) {
|
|
1499
1484
|
throw new betterCall.APIError("FORBIDDEN", {
|
|
1500
1485
|
message: ORGANIZATION_ERROR_CODES.YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER
|
|
1501
1486
|
});
|
|
1502
1487
|
}
|
|
1503
|
-
if (!ctx.body.role) {
|
|
1504
|
-
throw new betterCall.APIError("BAD_REQUEST");
|
|
1505
|
-
}
|
|
1506
1488
|
const updatedMember = await adapter.updateMember(
|
|
1507
1489
|
ctx.body.memberId,
|
|
1508
1490
|
parseRoles(ctx.body.role)
|
|
@@ -1879,7 +1861,7 @@ const updateOrganization = refreshToken.createAuthEndpoint(
|
|
|
1879
1861
|
message: ORGANIZATION_ERROR_CODES.USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION
|
|
1880
1862
|
});
|
|
1881
1863
|
}
|
|
1882
|
-
const canUpdateOrg = hasPermission({
|
|
1864
|
+
const canUpdateOrg = hasPermission.hasPermission({
|
|
1883
1865
|
permission: {
|
|
1884
1866
|
organization: ["update"]
|
|
1885
1867
|
},
|
|
@@ -1957,7 +1939,7 @@ const deleteOrganization = refreshToken.createAuthEndpoint(
|
|
|
1957
1939
|
}
|
|
1958
1940
|
});
|
|
1959
1941
|
}
|
|
1960
|
-
const canDeleteOrg = hasPermission({
|
|
1942
|
+
const canDeleteOrg = hasPermission.hasPermission({
|
|
1961
1943
|
role: member.role,
|
|
1962
1944
|
permission: {
|
|
1963
1945
|
organization: ["delete"]
|
|
@@ -2255,7 +2237,7 @@ const createTeam = (options) => refreshToken.createAuthEndpoint(
|
|
|
2255
2237
|
message: ORGANIZATION_ERROR_CODES.YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION
|
|
2256
2238
|
});
|
|
2257
2239
|
}
|
|
2258
|
-
const canCreate = hasPermission({
|
|
2240
|
+
const canCreate = hasPermission.hasPermission({
|
|
2259
2241
|
role: member.role,
|
|
2260
2242
|
options: ctx.context.orgOptions,
|
|
2261
2243
|
permission: {
|
|
@@ -2327,7 +2309,7 @@ const removeTeam = refreshToken.createAuthEndpoint(
|
|
|
2327
2309
|
message: ORGANIZATION_ERROR_CODES.YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION
|
|
2328
2310
|
});
|
|
2329
2311
|
}
|
|
2330
|
-
const canRemove = hasPermission({
|
|
2312
|
+
const canRemove = hasPermission.hasPermission({
|
|
2331
2313
|
role: member.role,
|
|
2332
2314
|
options: ctx.context.orgOptions,
|
|
2333
2315
|
permission: {
|
|
@@ -2392,7 +2374,7 @@ const updateTeam = refreshToken.createAuthEndpoint(
|
|
|
2392
2374
|
message: ORGANIZATION_ERROR_CODES.YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM
|
|
2393
2375
|
});
|
|
2394
2376
|
}
|
|
2395
|
-
const canUpdate = hasPermission({
|
|
2377
|
+
const canUpdate = hasPermission.hasPermission({
|
|
2396
2378
|
role: member.role,
|
|
2397
2379
|
options: ctx.context.orgOptions,
|
|
2398
2380
|
permission: {
|
|
@@ -2609,7 +2591,7 @@ const organization = (options) => {
|
|
|
2609
2591
|
message: ORGANIZATION_ERROR_CODES.USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION
|
|
2610
2592
|
});
|
|
2611
2593
|
}
|
|
2612
|
-
const result = hasPermission({
|
|
2594
|
+
const result = hasPermission.hasPermission({
|
|
2613
2595
|
role: member.role,
|
|
2614
2596
|
options,
|
|
2615
2597
|
permission: ctx.body.permission
|
|
@@ -10,7 +10,7 @@ require('./better-auth.GpOOav9x.cjs');
|
|
|
10
10
|
require('defu');
|
|
11
11
|
const date = require('./better-auth.C1hdVENX.cjs');
|
|
12
12
|
const pluginHelper = require('./better-auth.DNqtHmvg.cjs');
|
|
13
|
-
const
|
|
13
|
+
const hasPermission = require('./better-auth.CApEjVDP.cjs');
|
|
14
14
|
|
|
15
15
|
const ADMIN_ERROR_CODES = {
|
|
16
16
|
FAILED_TO_CREATE_USER: "Failed to create user",
|
|
@@ -28,22 +28,6 @@ const ADMIN_ERROR_CODES = {
|
|
|
28
28
|
BANNED_USER: "You have been banned from this application"
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
const hasPermission = (input) => {
|
|
32
|
-
if (input.options?.adminUserIds?.includes(input.userId)) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
const roles = (input.role || input.options?.defaultRole || "user").split(",");
|
|
36
|
-
const acRoles = input.options?.roles || plugins_admin_access_index.defaultRoles;
|
|
37
|
-
for (const role of roles) {
|
|
38
|
-
const _role = acRoles[role];
|
|
39
|
-
const result = _role?.authorize(input.permission);
|
|
40
|
-
if (result?.success) {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return false;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
31
|
function parseRoles(roles) {
|
|
48
32
|
return Array.isArray(roles) ? roles.join(",") : roles;
|
|
49
33
|
}
|
|
@@ -177,7 +161,7 @@ const admin = (options) => {
|
|
|
177
161
|
}
|
|
178
162
|
},
|
|
179
163
|
async (ctx) => {
|
|
180
|
-
const canSetRole = hasPermission({
|
|
164
|
+
const canSetRole = hasPermission.hasPermission({
|
|
181
165
|
userId: ctx.context.session.user.id,
|
|
182
166
|
role: ctx.context.session.user.role,
|
|
183
167
|
options: opts,
|
|
@@ -269,7 +253,7 @@ const admin = (options) => {
|
|
|
269
253
|
throw ctx.error("UNAUTHORIZED");
|
|
270
254
|
}
|
|
271
255
|
if (session) {
|
|
272
|
-
const canCreateUser = hasPermission({
|
|
256
|
+
const canCreateUser = hasPermission.hasPermission({
|
|
273
257
|
userId: session.user.id,
|
|
274
258
|
role: session.user.role,
|
|
275
259
|
options: opts,
|
|
@@ -396,7 +380,7 @@ const admin = (options) => {
|
|
|
396
380
|
},
|
|
397
381
|
async (ctx) => {
|
|
398
382
|
const session = ctx.context.session;
|
|
399
|
-
const canListUsers = hasPermission({
|
|
383
|
+
const canListUsers = hasPermission.hasPermission({
|
|
400
384
|
userId: ctx.context.session.user.id,
|
|
401
385
|
role: session.user.role,
|
|
402
386
|
options: opts,
|
|
@@ -491,7 +475,7 @@ const admin = (options) => {
|
|
|
491
475
|
},
|
|
492
476
|
async (ctx) => {
|
|
493
477
|
const session = ctx.context.session;
|
|
494
|
-
const canListSessions = hasPermission({
|
|
478
|
+
const canListSessions = hasPermission.hasPermission({
|
|
495
479
|
userId: ctx.context.session.user.id,
|
|
496
480
|
role: session.user.role,
|
|
497
481
|
options: opts,
|
|
@@ -549,7 +533,7 @@ const admin = (options) => {
|
|
|
549
533
|
},
|
|
550
534
|
async (ctx) => {
|
|
551
535
|
const session = ctx.context.session;
|
|
552
|
-
const canBanUser = hasPermission({
|
|
536
|
+
const canBanUser = hasPermission.hasPermission({
|
|
553
537
|
userId: ctx.context.session.user.id,
|
|
554
538
|
role: session.user.role,
|
|
555
539
|
options: opts,
|
|
@@ -624,7 +608,7 @@ const admin = (options) => {
|
|
|
624
608
|
},
|
|
625
609
|
async (ctx) => {
|
|
626
610
|
const session = ctx.context.session;
|
|
627
|
-
const canBanUser = hasPermission({
|
|
611
|
+
const canBanUser = hasPermission.hasPermission({
|
|
628
612
|
userId: ctx.context.session.user.id,
|
|
629
613
|
role: session.user.role,
|
|
630
614
|
options: opts,
|
|
@@ -696,7 +680,7 @@ const admin = (options) => {
|
|
|
696
680
|
}
|
|
697
681
|
},
|
|
698
682
|
async (ctx) => {
|
|
699
|
-
const canImpersonateUser = hasPermission({
|
|
683
|
+
const canImpersonateUser = hasPermission.hasPermission({
|
|
700
684
|
userId: ctx.context.session.user.id,
|
|
701
685
|
role: ctx.context.session.user.role,
|
|
702
686
|
options: opts,
|
|
@@ -835,7 +819,7 @@ const admin = (options) => {
|
|
|
835
819
|
},
|
|
836
820
|
async (ctx) => {
|
|
837
821
|
const session = ctx.context.session;
|
|
838
|
-
const canRevokeSession = hasPermission({
|
|
822
|
+
const canRevokeSession = hasPermission.hasPermission({
|
|
839
823
|
userId: ctx.context.session.user.id,
|
|
840
824
|
role: session.user.role,
|
|
841
825
|
options: opts,
|
|
@@ -893,7 +877,7 @@ const admin = (options) => {
|
|
|
893
877
|
},
|
|
894
878
|
async (ctx) => {
|
|
895
879
|
const session = ctx.context.session;
|
|
896
|
-
const canRevokeSession = hasPermission({
|
|
880
|
+
const canRevokeSession = hasPermission.hasPermission({
|
|
897
881
|
userId: ctx.context.session.user.id,
|
|
898
882
|
role: session.user.role,
|
|
899
883
|
options: opts,
|
|
@@ -949,7 +933,7 @@ const admin = (options) => {
|
|
|
949
933
|
},
|
|
950
934
|
async (ctx) => {
|
|
951
935
|
const session = ctx.context.session;
|
|
952
|
-
const canDeleteUser = hasPermission({
|
|
936
|
+
const canDeleteUser = hasPermission.hasPermission({
|
|
953
937
|
userId: ctx.context.session.user.id,
|
|
954
938
|
role: session.user.role,
|
|
955
939
|
options: opts,
|
|
@@ -1007,7 +991,7 @@ const admin = (options) => {
|
|
|
1007
991
|
}
|
|
1008
992
|
},
|
|
1009
993
|
async (ctx) => {
|
|
1010
|
-
const canSetUserPassword = hasPermission({
|
|
994
|
+
const canSetUserPassword = hasPermission.hasPermission({
|
|
1011
995
|
userId: ctx.context.session.user.id,
|
|
1012
996
|
role: ctx.context.session.user.role,
|
|
1013
997
|
options: opts,
|
|
@@ -1105,7 +1089,7 @@ const admin = (options) => {
|
|
|
1105
1089
|
message: "user not found"
|
|
1106
1090
|
});
|
|
1107
1091
|
}
|
|
1108
|
-
const result = hasPermission({
|
|
1092
|
+
const result = hasPermission.hasPermission({
|
|
1109
1093
|
userId: user.id,
|
|
1110
1094
|
role: user.role,
|
|
1111
1095
|
options,
|