@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 +7 -0
- package/package.json +1 -1
- package/server/api/permissions/me.get.ts +15 -9
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
|
@@ -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.
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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 ?? [] }
|