@objectstack/plugin-auth 11.2.0 → 11.3.0
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/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
package/dist/index.mjs
CHANGED
|
@@ -3476,7 +3476,9 @@ var AuthPlugin = class {
|
|
|
3476
3476
|
if (!session?.user?.id) {
|
|
3477
3477
|
return c.json({ success: false, error: { code: "unauthorized", message: "Sign in first" } }, 401);
|
|
3478
3478
|
}
|
|
3479
|
-
|
|
3479
|
+
const u = session.user;
|
|
3480
|
+
const isAdmin = u?.isPlatformAdmin === true || Array.isArray(u?.roles) && u.roles.includes("platform_admin") || u?.role === "admin";
|
|
3481
|
+
if (!isAdmin) {
|
|
3480
3482
|
return c.json({ success: false, error: { code: "forbidden", message: "Admin role required" } }, 403);
|
|
3481
3483
|
}
|
|
3482
3484
|
const dataEngine = this.authManager.getDataEngine();
|