@plutocms/supabase 0.11.2 → 0.11.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.11.3](https://github.com/plutocms/supabase/compare/v0.11.2...v0.11.3) (2026-10-22)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **permissions:** treat a profile admin as admin when my_capabilities() is missing ([#96](https://github.com/plutocms/supabase/issues/96)) ([f0e4980](https://github.com/plutocms/supabase/commit/f0e49808d0a7ceb9ffec45947e9ba5a1a033b9aa))
9
+
3
10
  ## [0.11.2](https://github.com/plutocms/supabase/compare/v0.11.1...v0.11.2) (2026-10-22)
4
11
 
5
12
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@plutocms/supabase",
3
3
  "type": "module",
4
- "version": "0.11.2",
4
+ "version": "0.11.3",
5
5
  "trustedDependencies": [
6
6
  "@parcel/watcher",
7
7
  "@plutocms/pluto",
@@ -20,15 +20,21 @@ export default defineEventHandler(async (event) => {
20
20
  // public.my_capabilities() is defined by 004_roles_and_capabilities.sql.
21
21
  // A site that has upgraded this package but not yet applied that
22
22
  // migration has no such function yet — that is an expected, temporary
23
- // state during an upgrade, not a server error. Degrade to an empty
24
- // capability list (the same shape a signed-out caller gets above)
25
- // rather than 500ing: the caller already fails every can() check with
26
- // an empty list, which is the correct, safe behavior until the pending
27
- // migration is applied through /admin/migrations (itself gated by
28
- // requireAdmin, not a capability, precisely so this state is always
29
- // recoverable — see server/utils/admin-guard.ts).
30
- console.error('my_capabilities() failed, returning an empty capability list:', error.message)
31
- return { capabilities: [] as string[] }
23
+ // state during an upgrade, not a server error. Fall back to the
24
+ // profiles.is_admin column (the same check as requireAdmin, which gates
25
+ // /admin/migrations): an admin gets ['*'], everyone else an empty list.
26
+ // Without the fallback, the admin guard would see an admin with no
27
+ // capability and keep them out of /admin/migrations, the one page that
28
+ // can apply the missing migration.
29
+ console.error('my_capabilities() failed, falling back to profiles.is_admin:', error.message)
30
+
31
+ const { data: profile } = await client
32
+ .from('profiles')
33
+ .select('is_admin')
34
+ .eq('id', user.sub)
35
+ .maybeSingle()
36
+
37
+ return { capabilities: profile?.is_admin ? ['*'] : ([] as string[]) }
32
38
  }
33
39
 
34
40
  return { capabilities: data ?? [] }