Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
Fix repository permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
seggewiss committed Oct 9, 2023
1 parent 27370e3 commit 91027af
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file.

## [3.0.15] - 09.10.2023

## Changed
- Changed `handle` of `channel.ts` to only validate dataset collections and entities

## [3.0.13] - 21.07.2023

## Fixed
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "@shopware-ag/admin-extension-sdk",
"license": "MIT",
"version": "3.0.14",
"version": "3.0.15",
"repository": "git://github.com/shopware/admin-extension-sdk.git",
"description": "The SDK for App iframes to communicate with the Shopware Administration",
"keywords": [
Expand Down
26 changes: 26 additions & 0 deletions src/channel.ts
Expand Up @@ -315,6 +315,22 @@ export function handle<MESSAGE_TYPE extends keyof ShopwareMessageTypes>

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
const responseValue = await Promise.resolve((() => {
const responseValidationTypes = [
'datasetSubscribe',
'datasetGet',
'datasetUpdate',
// Test value
'_collectionTest',
];

if (!responseValidationTypes.includes(type)) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return method(
deserializedMessageData._data,
{ _event_: event }
);
}

/*
* Validate incoming handle messages for privileges
* in Entity and Entity Collection
Expand Down Expand Up @@ -346,6 +362,16 @@ export function handle<MESSAGE_TYPE extends keyof ShopwareMessageTypes>
// Replace methods etc. so that they are working in JSON format
const serializedResponseMessage = ((): ShopwareMessageResponseData<MESSAGE_TYPE> => {
let serializedMessage = serialize(responseMessage) as ShopwareMessageResponseData<MESSAGE_TYPE>;
const messageValidationTypes = [
'datasetSubscribe',
'datasetGet',
// Test value
'_collectionTest',
];

if (!messageValidationTypes.includes(type)) {
return serializedMessage;
}

// Validate if response value contains entity data where the app has no privileges for
const validationErrors = validate({
Expand Down

0 comments on commit 91027af

Please sign in to comment.