@malevich-studio/strapi-sdk-typescript 1.2.17 → 1.2.19
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/cli.cjs +9 -8
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +9 -8
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +8 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.mjs +8 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -21437,20 +21437,21 @@ class Strapi {
|
|
|
21437
21437
|
return data;
|
|
21438
21438
|
}
|
|
21439
21439
|
async can(uid, controller, action) {
|
|
21440
|
-
if (!this.
|
|
21441
|
-
const
|
|
21442
|
-
|
|
21440
|
+
if (!this.permissionsList) {
|
|
21441
|
+
const { role } = await this.me();
|
|
21442
|
+
const response = await this.fetchData(`users-permissions/role/${role?.documentId}`);
|
|
21443
|
+
this.permissionsList = response.role.permissions;
|
|
21443
21444
|
}
|
|
21444
|
-
if (!this.
|
|
21445
|
+
if (!this.permissionsList[uid]) {
|
|
21445
21446
|
throw new Error(`Permissions for ${uid} not found!`);
|
|
21446
21447
|
}
|
|
21447
|
-
if (!this.
|
|
21448
|
+
if (!this.permissionsList[uid].controllers[controller]) {
|
|
21448
21449
|
throw new Error(`Permissions for ${uid}.${controller} not found!`);
|
|
21449
21450
|
}
|
|
21450
|
-
if (!this.
|
|
21451
|
+
if (!this.permissionsList[uid].controllers[controller][action]) {
|
|
21451
21452
|
throw new Error(`Permission for ${uid}.${controller}.${action} not found!`);
|
|
21452
21453
|
}
|
|
21453
|
-
return this.
|
|
21454
|
+
return this.permissionsList[uid].controllers[controller][action].enabled;
|
|
21454
21455
|
}
|
|
21455
21456
|
}
|
|
21456
21457
|
|