You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(web): rename withAuthV2 to withAuth (#1073)
* refactor(web): rename withAuthV2 to withAuth and move to middleware/
Renames withAuthV2/withOptionalAuthV2 to withAuth/withOptionalAuth and
relocates them from src/withAuthV2.ts to src/middleware/withAuth.ts.
Extracts withMinimumOrgRole and sew into their own files under middleware/.
Fixes 'use server' build error by removing logger export from actions.ts
and fixing mock path in withAuth.test.ts.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(web): update mock paths in listCommitsApi.test.ts
Update vi.mock paths from @/withAuthV2 to @/middleware/withAuth and
from @/actions to @/middleware/sew to match the renamed modules.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(web): use auth context prisma instead of global import in audit and userManagement actions
Replace direct @/prisma imports with the prisma instance from the
withAuth callback to ensure userScopedPrismaClientExtension is applied.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feedback
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -155,11 +155,11 @@ Server actions should be used for mutations (POST/PUT/DELETE operations), not fo
155
155
156
156
## Authentication
157
157
158
-
Use `withAuthV2` or `withOptionalAuthV2` from `@/withAuthV2` to protect server actions and API routes.
158
+
Use `withAuth` or `withOptionalAuth` from `@/middleware/withAuth` to protect server actions and API routes.
159
159
160
-
-**`withAuthV2`** - Requires authentication. Returns `notAuthenticated()` if user is not logged in.
161
-
-**`withOptionalAuthV2`** - Allows anonymous access if the org has anonymous access enabled. `user` may be `undefined`.
162
-
-**`withMinimumOrgRole`** - Wrap inside auth context to require a minimum role (e.g., `OrgRole.OWNER`).
160
+
-**`withAuth`** - Requires authentication. Returns `notAuthenticated()` if user is not logged in.
161
+
-**`withOptionalAuth`** - Allows anonymous access if the org has anonymous access enabled. `user` may be `undefined`.
162
+
-**`withMinimumOrgRole`** - Wrap inside auth context to require a minimum role (e.g., `OrgRole.OWNER`). Import from `@/middleware/withMinimumOrgRole`.
163
163
164
164
**Important:** Always use the `prisma` instance provided by the auth context. This instance has `userScopedPrismaClientExtension` applied, which enforces repository visibility rules (e.g., filtering repos based on user permissions). Do NOT import `prisma` directly from `@/prisma` in actions or routes that return data to the client.
165
165
@@ -168,19 +168,19 @@ Use `withAuthV2` or `withOptionalAuthV2` from `@/withAuthV2` to protect server a
0 commit comments