@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.js
CHANGED
|
@@ -3530,7 +3530,9 @@ var AuthPlugin = class {
|
|
|
3530
3530
|
if (!session?.user?.id) {
|
|
3531
3531
|
return c.json({ success: false, error: { code: "unauthorized", message: "Sign in first" } }, 401);
|
|
3532
3532
|
}
|
|
3533
|
-
|
|
3533
|
+
const u = session.user;
|
|
3534
|
+
const isAdmin = u?.isPlatformAdmin === true || Array.isArray(u?.roles) && u.roles.includes("platform_admin") || u?.role === "admin";
|
|
3535
|
+
if (!isAdmin) {
|
|
3534
3536
|
return c.json({ success: false, error: { code: "forbidden", message: "Admin role required" } }, 403);
|
|
3535
3537
|
}
|
|
3536
3538
|
const dataEngine = this.authManager.getDataEngine();
|