Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Merge branch 'master' into skip-count-unless-necessary

Marcin Gębala528d87440890
diff --cc poetry.lock
index 188a9b41b9,8982e4d9c1..f35861c525
--- a/poetry.lock
+++ b/poetry.lock
@@@ -148,10 -148,10 +148,10 @@@ description = "The AWS SDK for Python
name = "boto3"
optional = false
python-versions = "*"
- version = "1.12.42"
-version = "1.12.36"
++version = "1.12.43"
[package.dependencies]
- botocore = ">=1.15.42,<1.16.0"
-botocore = ">=1.15.36,<1.16.0"
++botocore = ">=1.15.43,<1.16.0"
jmespath = ">=0.7.1,<1.0.0"
s3transfer = ">=0.3.0,<0.4.0"
@@@ -161,7 -161,7 +161,7 @@@ description = "Low-level, data-driven c
name = "botocore"
optional = false
python-versions = "*"
- version = "1.15.42"
-version = "1.15.36"
++version = "1.15.43"
[package.dependencies]
docutils = ">=0.10,<0.16"
@@@ -529,12 -529,12 +529,12 @@@ description = "Convenient fields and cl
name = "django-measurement"
optional = false
python-versions = "*"
--version = "3.2.0"
++version = "3.2.3"
[package.dependencies]
--django = "*"
++django = ">=2.2"
django-appconf = ">=1.0.2"
--measurement = ">=1.6"
++measurement = ">=1.6,<4.0"
[[package]]
category = "main"
@@@ -806,7 -806,7 +806,7 @@@ description = "Google Authentication Li
name = "google-auth"
optional = false
python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*"
- version = "1.14.0"
-version = "1.13.1"
++version = "1.14.1"
[package.dependencies]
cachetools = ">=2.0.0,<5.0"
@@@ -2238,12 -2238,12 +2238,12 @@@ black =
{file = "black-19.10b0.tar.gz", hash = "sha256:c2edb73a08e9e0e6f65a0e6af18b059b8b1cdd5bef997d7a0b181df93dc81539"},
]
boto3 = [
- {file = "boto3-1.12.42-py2.py3-none-any.whl", hash = "sha256:c205c9d69beb43f1dee6f8c30029a418afe1f82fc52a254d9f3b5ab24ee5dd00"},
- {file = "boto3-1.12.42.tar.gz", hash = "sha256:bd005143eadea91dcba536caffcdd19d9a4dbefa7f59ddd503ef0ef2e5079c36"},
- {file = "boto3-1.12.36-py2.py3-none-any.whl", hash = "sha256:57397f9ad3e9afc17e6100a38c6e631b6545aabc7f8c38b86ff2c6f5931d0ebf"},
- {file = "boto3-1.12.36.tar.gz", hash = "sha256:911994ef46595e8ab9f08eee6b666caea050937b96d54394292e958330cd7ad5"},
++ {file = "boto3-1.12.43-py2.py3-none-any.whl", hash = "sha256:bb0962faea24242a3105f6341537f9e19ee45aa07a9b62a6ffa274ada33280df"},
++ {file = "boto3-1.12.43.tar.gz", hash = "sha256:1a6a3d95d20cacd677e2af5cbff7027abea35b78f1b8126388ef7fa517655cfe"},
]
botocore = [
- {file = "botocore-1.15.42-py2.py3-none-any.whl", hash = "sha256:1b7730de543a751c2491f1510688f3c34a8b9669998d8b88f8facf6c3be3c790"},
- {file = "botocore-1.15.42.tar.gz", hash = "sha256:2ce77c2b11253b64a3d7ec0aa696c064d6ed83c32e6288fc2d59f485f8119828"},
- {file = "botocore-1.15.36-py2.py3-none-any.whl", hash = "sha256:d2233e19b6a60792185b15fe4cd8f92c5579298e5079daf17f66f6e639585e3a"},
- {file = "botocore-1.15.36.tar.gz", hash = "sha256:5fc5e8629b5375d591a47d05baaff6ccdf5c3b617aad1e14286be458092c9e53"},
++ {file = "botocore-1.15.43-py2.py3-none-any.whl", hash = "sha256:3b315934b20d7e4e3398a74fd90ea73622e0c1f609942ae0209506a041ae257f"},
++ {file = "botocore-1.15.43.tar.gz", hash = "sha256:9721e7b413e3b1b2b7670940e89d0088d1b83bd54cae1ccfe7305eb2e9361c17"},
]
braintree = [
{file = "braintree-3.49.0-py2.py3-none-any.whl", hash = "sha256:7cdd715a5a61339e4e5dcb5611cf80512d5fdb0e4da69307a64141d3597357f7"},
@@@ -2410,7 -2410,7 +2410,8 @@@ django-js-asset =
{file = "django_js_asset-1.2.2-py2.py3-none-any.whl", hash = "sha256:8ec12017f26eec524cab436c64ae73033368a372970af4cf42d9354fcb166bdd"},
]
django-measurement = [
-- {file = "django-measurement-3.2.0.tar.gz", hash = "sha256:f71ca00e5fa09170a8bc3e6b90b74f907d4ede8633c569b47dca56e40aad50ab"},
++ {file = "django-measurement-3.2.3.tar.gz", hash = "sha256:8fda226239a4d4ac033270e5bbd5aa3595c1c817f47a657c83f343b492b88220"},
++ {file = "django_measurement-3.2.3-py2.py3-none-any.whl", hash = "sha256:aca86e10dc603ea53595ca80aaa43824480342d969e469f4ec83b12df3bad65b"},
]
django-mptt = [
{file = "django-mptt-0.11.0.tar.gz", hash = "sha256:dfdb3af75ad27cdd4458b0544ec8574174f2b90f99bc2cafab6a15b4bc1895a8"},
@@@ -2486,12 -2486,12 +2487,12 @@@ freezegun =
{file = "freezegun-0.3.15.tar.gz", hash = "sha256:e2062f2c7f95cc276a834c22f1a17179467176b624cc6f936e8bc3be5535ad1b"},
]
google-api-core = [
- {file = "google-api-core-1.16.0.tar.gz", hash = "sha256:92e962a087f1c4b8d1c5c88ade1c1dfd550047dcffb320c57ef6a534a20403e2"},
- {file = "google_api_core-1.16.0-py2.py3-none-any.whl", hash = "sha256:859f7392676761f2b160c6ee030c3422135ada4458f0948c5690a6a7c8d86294"},
+ {file = "google-api-core-1.17.0.tar.gz", hash = "sha256:e4082a0b479dc2dee2f8d7b80ea8b5d0184885b773caab15ab1836277a01d689"},
+ {file = "google_api_core-1.17.0-py2.py3-none-any.whl", hash = "sha256:c0e430658ed6be902d7ba7095fb0a9cac810270d71bf7ac4484e76c300407aae"},
]
google-auth = [
- {file = "google-auth-1.14.0.tar.gz", hash = "sha256:9813eaae335c45e8a1b5d274610fa961ac8aa650568d1cfb005b2c07da6bde6c"},
- {file = "google_auth-1.14.0-py2.py3-none-any.whl", hash = "sha256:050f1713142fa57d4b34f4fd4a998210e330f6a29c84c6ce359b928cc11dc8ad"},
- {file = "google-auth-1.13.1.tar.gz", hash = "sha256:a5ee4c40fef77ea756cf2f1c0adcf475ecb53af6700cf9c133354cdc9b267148"},
- {file = "google_auth-1.13.1-py2.py3-none-any.whl", hash = "sha256:cab6c707e6ee20e567e348168a5c69dc6480384f777a9e5159f4299ad177dcc0"},
++ {file = "google-auth-1.14.1.tar.gz", hash = "sha256:e63b2210e03c4ed829063b72c4af0c4b867c2788efb3210b6b9439b488bd3afd"},
++ {file = "google_auth-1.14.1-py2.py3-none-any.whl", hash = "sha256:0c41a453b9a8e77975bfa436b8daedac00aed1c545d84410daff8272fff40fbb"},
]
google-cloud-core = [
{file = "google-cloud-core-1.3.0.tar.gz", hash = "sha256:878f9ad080a40cdcec85b92242c4b5819eeb8f120ebc5c9f640935e24fc129d8"},
diff --cc saleor/account/migrations/0042_merge_20200422_0555.py
index 0000000000,0000000000..d5eb342a79
new file mode 100644
--- /dev/null
+++ b/saleor/account/migrations/0042_merge_20200422_0555.py
@@@ -1,0 -1,0 +1,13 @@@
++# Generated by Django 3.0.5 on 2020-04-22 10:55
++
++from django.db import migrations
++
++
++class Migration(migrations.Migration):
++
++ dependencies = [
++ ("account", "0041_permissions_to_groups"),
++ ("account", "0041_merge_20200421_0529"),
++ ]
++
++ operations = []
diff --cc saleor/graphql/account/resolvers.py
index aa5dee6cd5,26a3acac7f..3cb70f947d
--- a/saleor/graphql/account/resolvers.py
+++ b/saleor/graphql/account/resolvers.py
@@@ -11,9 -12,24 +11,17 @@@ from ...account import model
from ...core.permissions import AccountPermissions
from ...payment import gateway
from ...payment.utils import fetch_customer_id
- from ..utils import filter_by_query_param, get_user_or_service_account_from_context
+ from ..utils import (
+ filter_by_query_param,
+ format_permissions_for_display,
+ get_user_or_service_account_from_context,
- sort_queryset,
-)
-from .sorters import (
- PermissionGroupSortingInput,
- ServiceAccountSortField,
- UserSortField,
- UserSortingInput,
+ )
from .types import AddressValidationData, ChoiceValue
- from .utils import get_allowed_fields_camel_case, get_required_fields_camel_case
+ from .utils import (
+ get_allowed_fields_camel_case,
+ get_required_fields_camel_case,
+ get_user_permissions,
+ )
USER_SEARCH_FIELDS = (
"email",
diff --cc saleor/graphql/account/types.py
index be38bfdc3f,ca88fd40e4..84a8034f57
--- a/saleor/graphql/account/types.py
+++ b/saleor/graphql/account/types.py
@@@ -452,10 -511,10 +511,10 @@@ class Group(CountableDjangoObjectType)
)
class Meta:
- description = ""
+ description = "Represents permission group data."
interfaces = [relay.Node]
model = auth_models.Group
- only_fields = ["name", "permissions", "users", "id"]
+ only_fields = ["name", "permissions", "id"]
@staticmethod
@permission_required(AccountPermissions.MANAGE_STAFF)
diff --cc saleor/graphql/utils/__init__.py
index dd1b410829,4e0c7b48e4..dd832a2de3
--- a/saleor/graphql/utils/__init__.py
+++ b/saleor/graphql/utils/__init__.py
@@@ -1,15 -1,16 +1,16 @@@
from typing import Union
import graphene
- from django.db.models import Q
-from django.db.models import Q, QuerySet, Value
++from django.db.models import Q, Value
+ from django.db.models.functions import Concat
from django.utils import timezone
from graphene_django.registry import get_global_registry
from graphql.error import GraphQLError
from graphql_jwt.utils import jwt_payload
from graphql_relay import from_global_id
-from .core.enums import PermissionEnum, ReportingPeriod
-from .core.types import Permission, SortInputObjectType
+from ..core.enums import PermissionEnum, ReportingPeriod
- from ..core.types import PermissionDisplay
++from ..core.types import Permission
ERROR_COULD_NO_RESOLVE_GLOBAL_ID = (
"Could not resolve to a node with the global id list of '%s'."