1
1
import graphene
2
- from nxtbn .core .admin_permissions import check_user_permissions
3
2
from nxtbn .product .admin_types import CategoryTranslationType , CategoryType , CollectionTranslationType , ProductTagTranslationType , ProductTranslationType , ProductVariantTranslationType , SupplierTranslationType
4
3
from nxtbn .product .models import Category , CategoryTranslation , CollectionTranslation , ProductTagTranslation , ProductTranslation , ProductVariantTranslation , SupplierTranslation
5
4
from nxtbn .users import UserRole
@@ -20,7 +19,6 @@ class Arguments:
20
19
category = graphene .Field (CategoryType )
21
20
22
21
def mutate (self , info , id , input ):
23
- check_user_permissions (info , allowed_roles = [UserRole .STORE_MANAGER , UserRole .ADMIN , UserRole .PRODUCT_MANAGER ])
24
22
category = Category .objects .get (id = id )
25
23
category .name = input .name
26
24
category .description = input .description
@@ -48,7 +46,6 @@ class Arguments:
48
46
product_translation = graphene .Field (ProductTranslationType )
49
47
50
48
def mutate (self , info , base_product_id , lang_code , name , summary , description , meta_title , meta_description ):
51
- check_user_permissions (info , allowed_roles = [UserRole .STORE_MANAGER , UserRole .ADMIN , UserRole .PRODUCT_MANAGER , UserRole .TRANSLATOR ])
52
49
try :
53
50
product_translation = ProductTranslation .objects .get (product_id = base_product_id , language_code = lang_code )
54
51
except ProductTranslation .DoesNotExist :
@@ -76,7 +73,6 @@ class Arguments:
76
73
category_translation = graphene .Field (CategoryTranslationType )
77
74
78
75
def mutate (self , info , base_category_id , lang_code , name , description , meta_title , meta_description ):
79
- check_user_permissions (info , allowed_roles = [UserRole .STORE_MANAGER , UserRole .ADMIN , UserRole .PRODUCT_MANAGER , UserRole .TRANSLATOR ])
80
76
try :
81
77
category_translation = CategoryTranslation .objects .get (category_id = base_category_id , language_code = lang_code )
82
78
except CategoryTranslation .DoesNotExist :
@@ -103,7 +99,6 @@ class Arguments:
103
99
supplier_translation = graphene .Field (SupplierTranslationType )
104
100
105
101
def mutate (self , info , base_supplier_id , lang_code , name , description , meta_title , meta_description ):
106
- check_user_permissions (info , allowed_roles = [UserRole .STORE_MANAGER , UserRole .ADMIN , UserRole .PRODUCT_MANAGER , UserRole .TRANSLATOR ])
107
102
try :
108
103
supplier_translation = SupplierTranslation .objects .get (supplier_id = base_supplier_id , language_code = lang_code )
109
104
except SupplierTranslation .DoesNotExist :
@@ -127,7 +122,6 @@ class Arguments:
127
122
product_variant_translation = graphene .Field (ProductVariantTranslationType )
128
123
129
124
def mutate (self , info , base_product_variant_id , lang_code , name , description , meta_title , meta_description ):
130
- check_user_permissions (info , allowed_roles = [UserRole .STORE_MANAGER , UserRole .ADMIN , UserRole .PRODUCT_MANAGER , UserRole .TRANSLATOR ])
131
125
try :
132
126
product_variant_translation = ProductVariantTranslation .objects .get (product_variant_id = base_product_variant_id , language_code = lang_code )
133
127
except ProductVariantTranslation .DoesNotExist :
@@ -147,7 +141,6 @@ class Arguments:
147
141
product_tag_translation = graphene .Field (ProductTagTranslationType )
148
142
149
143
def mutate (self , info , base_product_tag_id , lang_code , name , description , meta_title , meta_description ):
150
- check_user_permissions (info , allowed_roles = [UserRole .STORE_MANAGER , UserRole .ADMIN , UserRole .PRODUCT_MANAGER , UserRole .TRANSLATOR ])
151
144
try :
152
145
product_tag_translation = ProductTagTranslation .objects .get (product_tag_id = base_product_tag_id , language_code = lang_code )
153
146
except ProductTagTranslation .DoesNotExist :
@@ -170,7 +163,6 @@ class Arguments:
170
163
collection_translation = graphene .Field (CollectionTranslationType )
171
164
172
165
def mutate (self , info , base_collection_id , lang_code , name , description , meta_title , meta_description ):
173
- check_user_permissions (info , allowed_roles = [UserRole .STORE_MANAGER , UserRole .ADMIN , UserRole .PRODUCT_MANAGER , UserRole .TRANSLATOR ])
174
166
try :
175
167
collection_translation = CollectionTranslation .objects .get (collection_id = base_collection_id , language_code = lang_code )
176
168
except CollectionTranslation .DoesNotExist :
0 commit comments