@malevich-studio/strapi-sdk-typescript 1.2.17 → 1.2.18
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 +7 -7
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +7 -7
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -21461,20 +21461,20 @@ class Strapi {
|
|
|
21461
21461
|
return data;
|
|
21462
21462
|
}
|
|
21463
21463
|
async can(uid, controller, action) {
|
|
21464
|
-
if (!this.
|
|
21464
|
+
if (!this.permissionsList) {
|
|
21465
21465
|
const response = await this.fetchData('users-permissions/permissions');
|
|
21466
|
-
this.
|
|
21466
|
+
this.permissionsList = response.permissions;
|
|
21467
21467
|
}
|
|
21468
|
-
if (!this.
|
|
21468
|
+
if (!this.permissionsList[uid]) {
|
|
21469
21469
|
throw new Error(`Permissions for ${uid} not found!`);
|
|
21470
21470
|
}
|
|
21471
|
-
if (!this.
|
|
21471
|
+
if (!this.permissionsList[uid].controllers[controller]) {
|
|
21472
21472
|
throw new Error(`Permissions for ${uid}.${controller} not found!`);
|
|
21473
21473
|
}
|
|
21474
|
-
if (!this.
|
|
21474
|
+
if (!this.permissionsList[uid].controllers[controller][action]) {
|
|
21475
21475
|
throw new Error(`Permission for ${uid}.${controller}.${action} not found!`);
|
|
21476
21476
|
}
|
|
21477
|
-
return this.
|
|
21477
|
+
return this.permissionsList[uid].controllers[controller][action].enabled;
|
|
21478
21478
|
}
|
|
21479
21479
|
}
|
|
21480
21480
|
|
|
@@ -21972,7 +21972,7 @@ function generateMethodsCode(contentType) {
|
|
|
21972
21972
|
if (contentType.uid.startsWith('api::')) {
|
|
21973
21973
|
methods.push([
|
|
21974
21974
|
` public async can${getContentTypeName(contentType.schema.singularName)}(action: PermissionAction) {`,
|
|
21975
|
-
` return await this.can('${contentType.uid}', '${contentType.schema.singularName
|
|
21975
|
+
` return await this.can('${contentType.uid.split('.')[0]}', '${contentType.schema.singularName}', action);`,
|
|
21976
21976
|
' }',
|
|
21977
21977
|
].join('\n'));
|
|
21978
21978
|
}
|