@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/index.d.ts
CHANGED
|
@@ -178,8 +178,8 @@ declare class Strapi {
|
|
|
178
178
|
delete<T>(endpoint: string, id: string, params?: RequestInit): Promise<Response<T>>;
|
|
179
179
|
uploadForm(form: FormData): Promise<File[]>;
|
|
180
180
|
private baseFetch;
|
|
181
|
-
private
|
|
182
|
-
can(uid: string, controller: string, action:
|
|
181
|
+
private permissionsList?;
|
|
182
|
+
can(uid: string, controller: string, action: PermissionAction): Promise<boolean>;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
export { type AuthResponse, type DynamiczoneComponent, type DynamiczonePopulate, type ErrorResponse, type File, type FilterValue, type Filters, type Folder, type Locale, type PermissionAction, type Query, type RelationInput, type Response, Strapi, type SuccessResponse, type UserResponse };
|
package/dist/index.mjs
CHANGED
|
@@ -21435,20 +21435,20 @@ class Strapi {
|
|
|
21435
21435
|
return data;
|
|
21436
21436
|
}
|
|
21437
21437
|
async can(uid, controller, action) {
|
|
21438
|
-
if (!this.
|
|
21438
|
+
if (!this.permissionsList) {
|
|
21439
21439
|
const response = await this.fetchData('users-permissions/permissions');
|
|
21440
|
-
this.
|
|
21440
|
+
this.permissionsList = response.permissions;
|
|
21441
21441
|
}
|
|
21442
|
-
if (!this.
|
|
21442
|
+
if (!this.permissionsList[uid]) {
|
|
21443
21443
|
throw new Error(`Permissions for ${uid} not found!`);
|
|
21444
21444
|
}
|
|
21445
|
-
if (!this.
|
|
21445
|
+
if (!this.permissionsList[uid].controllers[controller]) {
|
|
21446
21446
|
throw new Error(`Permissions for ${uid}.${controller} not found!`);
|
|
21447
21447
|
}
|
|
21448
|
-
if (!this.
|
|
21448
|
+
if (!this.permissionsList[uid].controllers[controller][action]) {
|
|
21449
21449
|
throw new Error(`Permission for ${uid}.${controller}.${action} not found!`);
|
|
21450
21450
|
}
|
|
21451
|
-
return this.
|
|
21451
|
+
return this.permissionsList[uid].controllers[controller][action].enabled;
|
|
21452
21452
|
}
|
|
21453
21453
|
}
|
|
21454
21454
|
|