Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending app support #5767

Merged
merged 127 commits into from Jul 13, 2020
Merged

Extending app support #5767

merged 127 commits into from Jul 13, 2020

Conversation

korycins
Copy link
Member

@korycins korycins commented Jun 12, 2020

Docs explain everything - saleor/saleor-docs#131

Maciej Korycinski added 30 commits April 27, 2020 13:42
@codecov
Copy link

codecov bot commented Jun 19, 2020

Codecov Report

Merging #5767 into master will increase coverage by 0.09%.
The diff coverage is 97.20%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5767      +/-   ##
==========================================
+ Coverage   91.78%   91.88%   +0.09%     
==========================================
  Files         373      378       +5     
  Lines       23729    24163     +434     
  Branches     2187     2220      +33     
==========================================
+ Hits        21779    22201     +422     
- Misses       1428     1437       +9     
- Partials      522      525       +3     
Impacted Files Coverage Δ
saleor/graphql/tests/fixtures.py 98.30% <ø> (-0.09%) ⬇️
saleor/plugins/webhook/tasks.py 96.29% <ø> (ø)
saleor/webhook/models.py 92.30% <ø> (-1.45%) ⬇️
saleor/graphql/app/resolvers.py 85.71% <81.81%> (-14.29%) ⬇️
saleor/core/auth_backend.py 72.41% <86.66%> (+12.41%) ⬆️
saleor/graphql/app/filters.py 90.47% <87.50%> (-1.84%) ⬇️
saleor/graphql/app/mutations.py 97.04% <95.85%> (-1.80%) ⬇️
saleor/account/models.py 94.77% <100.00%> (+0.65%) ⬆️
saleor/app/error_codes.py 100.00% <100.00%> (ø)
saleor/app/installation_utils.py 100.00% <100.00%> (ø)
... and 27 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1f25dd7...95abf65. Read the comment docs.

@db-queries
Copy link

db-queries bot commented Jun 19, 2020

Here is the report for 95abf65 (mirumee/saleor @ feature/extending_app_support)
Base comparison is 1f25dd7.

**Found 13 differences!** (click me)

# saleor.graphql.accountbenchmark account
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
+ delete staff members                                       	         35	         32	              0
+ query staff user                                           	         21	         20	              4
+ staff create                                               	         24	         22	              4
+ staff update groups and permissions                        	         36	         33	              5

# saleor.graphql.accountbenchmark permission group
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
+ permission group create                                    	         21	         19	              2
+ permission group delete                                    	         22	         20	              3
+ permission group query                                     	          8	          7	              0
+ permission group update                                    	         36	         33	              1
+ permission group update remove users with manage staff     	         31	         27	              3

# saleor.graphql.checkoutbenchmark checkout mutations
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  add billing address to checkout                            	         50	         50	             26
  add shipping to checkout                                   	         37	         37	             11
  checkout email update                                      	         28	         28	             13
  checkout payment charge                                    	         29	         29	              7
  checkout shipping address update                           	         39	         39	             11
  checkout voucher code                                      	         57	         57	             31
  complete checkout                                          	         81	         81	             22
  create checkout                                            	        125	        125	             60
  update checkout lines                                      	         92	         92	             40

# saleor.graphql.checkoutbenchmark homepage
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  user checkout details                                      	         50	         50	             27

# saleor.graphql.menubenchmark homepage
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  retrieve main menu                                         	          5	          5	              0
  retrieve secondary menu                                    	          5	          5	              0

# saleor.graphql.orderbenchmark order
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  user order details                                         	         17	         17	              3

# saleor.graphql.productbenchmark category
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  category view                                              	         18	         18	              1

# saleor.graphql.productbenchmark collection
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  collection view                                            	         17	         17	              0

# saleor.graphql.productbenchmark homepage
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  featured products list                                     	         14	         14	              0
  retrieve product list                                      	          5	          5	              0

# saleor.graphql.productbenchmark product
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  product details                                            	         16	         16	              0
  retrieve product attributes                                	          7	          7	              0

# saleor.graphql.productbenchmark variant
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
+ product variant bulk create                                	         48	         47	              2
  retrieve variant list                                      	         18	         18	              2

# saleor.graphql.productbenchmark variant stocks
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
+ product variants stocks create                             	         23	         22	              5
+ product variants stocks delete                             	         20	         19	              5
+ product variants stocks update                             	         28	         27	              5

# saleor.graphql.producttest product sorting attributes
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  sort product not having attribute data                     	         20	         20	              0

# saleor.graphql.shopbenchmark homepage
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  retrieve shop                                              	          2	          2	              0

@korycins korycins marked this pull request as ready for review July 9, 2020 09:10
@korycins korycins force-pushed the feature/extending_app_support branch from 3abc7ae to b103eca Compare July 10, 2020 11:03
saleor/account/models.py Outdated Show resolved Hide resolved
saleor/plugins/webhook/tasks.py Show resolved Hide resolved
saleor/graphql/app/filters.py Outdated Show resolved Hide resolved
saleor/graphql/app/types.py Outdated Show resolved Hide resolved
Comment on lines +8 to +23
def ensure_can_manage_permissions(requestor, permission_items):
"""Check if requestor can manage permissions from input.

Requestor cannot manage permissions witch he doesn't have. It raises
ValidationError when requestor doesn't have required permissions.
"""
if requestor_is_superuser(requestor):
return
missing_permissions = get_out_of_scope_permissions(requestor, permission_items)
if missing_permissions:
error_msg = "You can't add permission that you don't have."
code = AppErrorCode.OUT_OF_SCOPE_PERMISSION.value
params = {"permissions": missing_permissions}
raise ValidationError(
{"permissions": ValidationError(error_msg, code=code, params=params)}
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If think we should create generic utility function from that, but maybe in other PR, the scope of this one is big enough 😄

saleor/graphql/core/mutations.py Outdated Show resolved Hide resolved
@maarcingebala maarcingebala merged commit 2c255c7 into master Jul 13, 2020
@maarcingebala maarcingebala deleted the feature/extending_app_support branch July 13, 2020 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants