Skip to content

Instantly share code, notes, and snippets.

@simonbru
Last active January 6, 2020 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonbru/2cde1e0cf080cdcdd961bd61114cf843 to your computer and use it in GitHub Desktop.
Save simonbru/2cde1e0cf080cdcdd961bd61114cf843 to your computer and use it in GitHub Desktop.
HAR for saleor issue with product permissions #5138
{
"log": {
"version": "1.2",
"creator": {
"name": "Firefox",
"version": "72.0"
},
"browser": {
"name": "Firefox",
"version": "72.0"
},
"pages": [
{
"startedDateTime": "2020-01-06T13:10:09.393+01:00",
"id": "page_1",
"pageTimings": {
"onContentLoad": 1390,
"onLoad": 1904
}
}
],
"entries": [
{
"pageref": "page_1",
"startedDateTime": "2020-01-06T13:10:09.393+01:00",
"request": {
"bodySize": 2837,
"method": "POST",
"url": "http://localhost:8000/graphql/",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Host",
"value": "localhost:8000"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0"
},
{
"name": "Accept",
"value": "*/*"
},
{
"name": "Accept-Language",
"value": "fr-CH,fr;q=0.8,en-US;q=0.5,en;q=0.3"
},
{
"name": "Accept-Encoding",
"value": "gzip, deflate"
},
{
"name": "Referer",
"value": "http://localhost:9000/products/add"
},
{
"name": "content-type",
"value": "application/json"
},
{
"name": "Authorization",
"value": "JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImFzZEBhc2QuY29tIiwiZXhwIjoxNTc4MzExNzQ3LCJvcmlnSWF0IjoxNTc4MzExNDQ3LCJpc19zdGFmZiI6dHJ1ZSwiaXNfc3VwZXJ1c2VyIjpmYWxzZX0.kK1ZOz0jnw5_i9153mXiJ6DDVnLrvZ9IVTaVjidvIag"
},
{
"name": "Origin",
"value": "http://localhost:9000"
},
{
"name": "Content-Length",
"value": "2837"
},
{
"name": "Connection",
"value": "keep-alive"
}
],
"cookies": [],
"queryString": [],
"headersSize": 617,
"postData": {
"mimeType": "application/json",
"params": [],
"text": "{\"operationName\":\"ProductCreate\",\"variables\":{\"attributes\":[{\"id\":\"QXR0cmlidXRlOjIx\",\"values\":[\"51\"]}],\"basePrice\":\"22\",\"category\":\"Q2F0ZWdvcnk6Nw==\",\"chargeTaxes\":true,\"collections\":[],\"descriptionJson\":\"{}\",\"isPublished\":false,\"name\":\"Someproduct\",\"productType\":\"UHJvZHVjdFR5cGU6MTE=\",\"publicationDate\":null,\"seo\":{\"description\":\"\",\"title\":\"\"},\"sku\":\"product11\",\"stockQuantity\":\"13\"},\"query\":\"fragment ProductImageFragment on ProductImage {\\n id\\n alt\\n sortOrder\\n url\\n __typename\\n}\\n\\nfragment Money on Money {\\n amount\\n currency\\n __typename\\n}\\n\\nfragment Product on Product {\\n id\\n name\\n descriptionJson\\n seoTitle\\n seoDescription\\n category {\\n id\\n name\\n __typename\\n }\\n collections {\\n id\\n name\\n __typename\\n }\\n basePrice {\\n ...Money\\n __typename\\n }\\n margin {\\n start\\n stop\\n __typename\\n }\\n purchaseCost {\\n start {\\n ...Money\\n __typename\\n }\\n stop {\\n ...Money\\n __typename\\n }\\n __typename\\n }\\n isAvailable\\n isPublished\\n chargeTaxes\\n publicationDate\\n attributes {\\n attribute {\\n id\\n slug\\n name\\n inputType\\n valueRequired\\n values {\\n id\\n name\\n slug\\n __typename\\n }\\n __typename\\n }\\n values {\\n id\\n name\\n slug\\n __typename\\n }\\n __typename\\n }\\n pricing {\\n priceRange {\\n start {\\n net {\\n ...Money\\n __typename\\n }\\n __typename\\n }\\n stop {\\n net {\\n ...Money\\n __typename\\n }\\n __typename\\n }\\n __typename\\n }\\n __typename\\n }\\n images {\\n ...ProductImageFragment\\n __typename\\n }\\n variants {\\n id\\n sku\\n name\\n priceOverride {\\n ...Money\\n __typename\\n }\\n margin\\n quantity\\n quantityAllocated\\n stockQuantity\\n __typename\\n }\\n productType {\\n id\\n name\\n hasVariants\\n __typename\\n }\\n url\\n __typename\\n}\\n\\nmutation ProductCreate($attributes: [AttributeValueInput], $publicationDate: Date, $category: ID!, $chargeTaxes: Boolean!, $collections: [ID], $descriptionJson: JSONString, $isPublished: Boolean!, $name: String!, $basePrice: Decimal, $productType: ID!, $sku: String, $stockQuantity: Int, $seo: SeoInput) {\\n productCreate(input: {attributes: $attributes, publicationDate: $publicationDate, category: $category, chargeTaxes: $chargeTaxes, collections: $collections, descriptionJson: $descriptionJson, isPublished: $isPublished, name: $name, basePrice: $basePrice, productType: $productType, sku: $sku, quantity: $stockQuantity, seo: $seo}) {\\n errors {\\n field\\n message\\n __typename\\n }\\n product {\\n ...Product\\n __typename\\n }\\n __typename\\n }\\n}\\n\"}"
}
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Date",
"value": "Mon, 06 Jan 2020 12:10:09 GMT"
},
{
"name": "Server",
"value": "WSGIServer/0.2 CPython/3.8.0"
},
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Access-Control-Allow-Origin",
"value": "*"
},
{
"name": "Access-Control-Allow-Methods",
"value": "POST, OPTIONS"
},
{
"name": "Access-Control-Allow-Headers",
"value": "Origin, Content-Type, Accept, Authorization"
},
{
"name": "Content-Length",
"value": "2814"
}
],
"cookies": [],
"content": {
"mimeType": "application/json",
"size": 2814,
"text": "{\"errors\": [{\"message\": \"You do not have permission to perform this action\", \"locations\": [{\"line\": 112, \"column\": 5}], \"path\": [\"productCreate\", \"product\", \"variants\", 0, \"quantityAllocated\"], \"extensions\": {\"exception\": {\"code\": \"PermissionDenied\", \"stacktrace\": [\"Traceback (most recent call last):\", \" File \\\"/usr/local/lib/python3.8/site-packages/promise/promise.py\\\", line 487, in _resolve_from_executor\", \" executor(resolve, reject)\", \" File \\\"/usr/local/lib/python3.8/site-packages/promise/promise.py\\\", line 754, in executor\", \" return resolve(f(*args, **kwargs))\", \" File \\\"/usr/local/lib/python3.8/site-packages/graphql/execution/middleware.py\\\", line 75, in make_it_promise\", \" return next(*args, **kwargs)\", \" File \\\"/usr/local/lib/python3.8/site-packages/graphql_jwt/decorators.py\\\", line 31, in wrapper\", \" return func(info.context, *args, **kwargs)\", \" File \\\"/app/saleor/graphql/decorators.py\\\", line 18, in wrapper\", \" raise exceptions.PermissionDenied()\", \"graphql_jwt.exceptions.PermissionDenied: You do not have permission to perform this action\"]}}}], \"data\": {\"productCreate\": {\"errors\": [], \"product\": {\"id\": \"UHJvZHVjdDoxMjI=\", \"name\": \"Someproduct\", \"descriptionJson\": \"{}\", \"seoTitle\": \"\", \"seoDescription\": \"\", \"category\": {\"id\": \"Q2F0ZWdvcnk6Nw==\", \"name\": \"Accessories\", \"__typename\": \"Category\"}, \"collections\": [], \"basePrice\": {\"amount\": 22.0, \"currency\": \"USD\", \"__typename\": \"Money\"}, \"margin\": {\"start\": 0, \"stop\": 0, \"__typename\": \"Margin\"}, \"purchaseCost\": {\"start\": {\"amount\": 0.0, \"currency\": \"USD\", \"__typename\": \"Money\"}, \"stop\": {\"amount\": 0.0, \"currency\": \"USD\", \"__typename\": \"Money\"}, \"__typename\": \"MoneyRange\"}, \"isAvailable\": false, \"isPublished\": false, \"chargeTaxes\": true, \"publicationDate\": null, \"attributes\": [{\"attribute\": {\"id\": \"QXR0cmlidXRlOjIx\", \"slug\": \"abv\", \"name\": \"ABV\", \"inputType\": \"DROPDOWN\", \"valueRequired\": false, \"values\": [{\"id\": \"QXR0cmlidXRlVmFsdWU6Njg=\", \"name\": \"5.1%\", \"slug\": \"51\", \"__typename\": \"AttributeValue\"}, {\"id\": \"QXR0cmlidXRlVmFsdWU6Njk=\", \"name\": \"6.7%\", \"slug\": \"67\", \"__typename\": \"AttributeValue\"}], \"__typename\": \"Attribute\"}, \"values\": [{\"id\": \"QXR0cmlidXRlVmFsdWU6Njg=\", \"name\": \"5.1%\", \"slug\": \"51\", \"__typename\": \"AttributeValue\"}], \"__typename\": \"SelectedAttribute\"}], \"pricing\": {\"priceRange\": {\"start\": {\"net\": {\"amount\": 22.0, \"currency\": \"USD\", \"__typename\": \"Money\"}, \"__typename\": \"TaxedMoney\"}, \"stop\": {\"net\": {\"amount\": 22.0, \"currency\": \"USD\", \"__typename\": \"Money\"}, \"__typename\": \"TaxedMoney\"}, \"__typename\": \"TaxedMoneyRange\"}, \"__typename\": \"ProductPricingInfo\"}, \"images\": [], \"variants\": [null], \"productType\": {\"id\": \"UHJvZHVjdFR5cGU6MTE=\", \"name\": \"Beer\", \"hasVariants\": false, \"__typename\": \"ProductType\"}, \"url\": \"\", \"__typename\": \"Product\"}, \"__typename\": \"ProductCreate\"}}}"
},
"redirectURL": "",
"headersSize": 300,
"bodySize": 3114
},
"cache": {},
"timings": {
"blocked": 0,
"dns": 0,
"connect": 0,
"ssl": 0,
"send": 0,
"wait": 351,
"receive": 0
},
"time": 351,
"_securityState": "insecure",
"serverIPAddress": "127.0.0.1",
"connection": "8000"
}
]
}
}
{
"errors": [
{
"message": "You do not have permission to perform this action",
"locations": [
{
"line": 112,
"column": 5
}
],
"path": [
"productCreate",
"product",
"variants",
0,
"quantityAllocated"
],
"extensions": {
"exception": {
"code": "PermissionDenied",
"stacktrace": [
"Traceback (most recent call last):",
" File \"/usr/local/lib/python3.8/site-packages/promise/promise.py\", line 487, in _resolve_from_executor",
" executor(resolve, reject)",
" File \"/usr/local/lib/python3.8/site-packages/promise/promise.py\", line 754, in executor",
" return resolve(f(*args, **kwargs))",
" File \"/usr/local/lib/python3.8/site-packages/graphql/execution/middleware.py\", line 75, in make_it_promise",
" return next(*args, **kwargs)",
" File \"/usr/local/lib/python3.8/site-packages/graphql_jwt/decorators.py\", line 31, in wrapper",
" return func(info.context, *args, **kwargs)",
" File \"/app/saleor/graphql/decorators.py\", line 18, in wrapper",
" raise exceptions.PermissionDenied()",
"graphql_jwt.exceptions.PermissionDenied: You do not have permission to perform this action"
]
}
}
}
],
"data": {
"productCreate": {
"errors": [],
"product": {
"id": "UHJvZHVjdDoxMjI=",
"name": "Someproduct",
"descriptionJson": "{}",
"seoTitle": "",
"seoDescription": "",
"category": {
"id": "Q2F0ZWdvcnk6Nw==",
"name": "Accessories",
"__typename": "Category"
},
"collections": [],
"basePrice": {
"amount": 22.0,
"currency": "USD",
"__typename": "Money"
},
"margin": {
"start": 0,
"stop": 0,
"__typename": "Margin"
},
"purchaseCost": {
"start": {
"amount": 0.0,
"currency": "USD",
"__typename": "Money"
},
"stop": {
"amount": 0.0,
"currency": "USD",
"__typename": "Money"
},
"__typename": "MoneyRange"
},
"isAvailable": false,
"isPublished": false,
"chargeTaxes": true,
"publicationDate": null,
"attributes": [
{
"attribute": {
"id": "QXR0cmlidXRlOjIx",
"slug": "abv",
"name": "ABV",
"inputType": "DROPDOWN",
"valueRequired": false,
"values": [
{
"id": "QXR0cmlidXRlVmFsdWU6Njg=",
"name": "5.1%",
"slug": "51",
"__typename": "AttributeValue"
},
{
"id": "QXR0cmlidXRlVmFsdWU6Njk=",
"name": "6.7%",
"slug": "67",
"__typename": "AttributeValue"
}
],
"__typename": "Attribute"
},
"values": [
{
"id": "QXR0cmlidXRlVmFsdWU6Njg=",
"name": "5.1%",
"slug": "51",
"__typename": "AttributeValue"
}
],
"__typename": "SelectedAttribute"
}
],
"pricing": {
"priceRange": {
"start": {
"net": {
"amount": 22.0,
"currency": "USD",
"__typename": "Money"
},
"__typename": "TaxedMoney"
},
"stop": {
"net": {
"amount": 22.0,
"currency": "USD",
"__typename": "Money"
},
"__typename": "TaxedMoney"
},
"__typename": "TaxedMoneyRange"
},
"__typename": "ProductPricingInfo"
},
"images": [],
"variants": [
null
],
"productType": {
"id": "UHJvZHVjdFR5cGU6MTE=",
"name": "Beer",
"hasVariants": false,
"__typename": "ProductType"
},
"url": "",
"__typename": "Product"
},
"__typename": "ProductCreate"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment