11using Grand . Business . Core . Interfaces . Checkout . Orders ;
22using Grand . Business . Core . Interfaces . Common . Addresses ;
3- using Grand . Business . Core . Interfaces . Common . Directory ;
43using Grand . Business . Core . Interfaces . Common . Localization ;
5- using Grand . Domain . Permissions ;
64using Grand . Domain . Common ;
75using Grand . Domain . Orders ;
8- using Grand . Infrastructure ;
9- using Grand . Web . Admin . Extensions ;
6+ using Grand . Domain . Permissions ;
7+ using Grand . Web . AdminShared . Extensions ;
108using Grand . Web . AdminShared . Interfaces ;
119using Grand . Web . AdminShared . Models . Orders ;
1210using Grand . Web . Common . DataSource ;
1311using Grand . Web . Common . Filters ;
1412using Grand . Web . Common . Security . Authorization ;
1513using Microsoft . AspNetCore . Mvc ;
16- using Grand . Web . AdminShared . Extensions ;
1714
1815namespace Grand . Web . Admin . Controllers ;
1916
@@ -26,16 +23,12 @@ public MerchandiseReturnController(
2623 IMerchandiseReturnViewModelService merchandiseReturnViewModelService ,
2724 ITranslationService translationService ,
2825 IMerchandiseReturnService merchandiseReturnService ,
29- IOrderService orderService ,
30- IContextAccessor contextAccessor ,
31- IGroupService groupService )
26+ IOrderService orderService )
3227 {
3328 _merchandiseReturnViewModelService = merchandiseReturnViewModelService ;
3429 _translationService = translationService ;
3530 _merchandiseReturnService = merchandiseReturnService ;
3631 _orderService = orderService ;
37- _contextAccessor = contextAccessor ;
38- _groupService = groupService ;
3932 }
4033
4134 #endregion
@@ -46,8 +39,6 @@ public MerchandiseReturnController(
4639 private readonly ITranslationService _translationService ;
4740 private readonly IMerchandiseReturnService _merchandiseReturnService ;
4841 private readonly IOrderService _orderService ;
49- private readonly IContextAccessor _contextAccessor ;
50- private readonly IGroupService _groupService ;
5142
5243 #endregion Fields
5344
@@ -69,11 +60,7 @@ public IActionResult List()
6960 [ HttpPost ]
7061 public async Task < IActionResult > List ( DataSourceRequest command , MerchandiseReturnListModel model )
7162 {
72- if ( await _groupService . IsStoreManager ( _contextAccessor . WorkContext . CurrentCustomer ) )
73- model . StoreId = _contextAccessor . WorkContext . CurrentCustomer . StaffStoreId ;
74- var merchandiseReturnModels =
75- await _merchandiseReturnViewModelService . PrepareMerchandiseReturnModel ( model , command . Page ,
76- command . PageSize ) ;
63+ var merchandiseReturnModels = await _merchandiseReturnViewModelService . PrepareMerchandiseReturnModel ( model , command . Page , command . PageSize ) ;
7764 var gridModel = new DataSourceResult {
7865 Data = merchandiseReturnModels . merchandiseReturnModels ,
7966 Total = merchandiseReturnModels . totalCount
@@ -97,10 +84,6 @@ public async Task<IActionResult> GoToId(MerchandiseReturnListModel model)
9784 //not found
9885 return RedirectToAction ( "List" , "MerchandiseReturn" ) ;
9986
100- if ( await _groupService . IsStoreManager ( _contextAccessor . WorkContext . CurrentCustomer ) &&
101- merchandiseReturn . StoreId != _contextAccessor . WorkContext . CurrentCustomer . StaffStoreId )
102- return RedirectToAction ( "List" , "MerchandiseReturn" ) ;
103-
10487 return RedirectToAction ( "Edit" , "MerchandiseReturn" , new { id = merchandiseReturn . Id } ) ;
10588 }
10689
@@ -112,9 +95,6 @@ public async Task<IActionResult> ProductsForMerchandiseReturn(string merchandise
11295 if ( merchandiseReturn == null )
11396 return ErrorForKendoGridJson ( "Merchandise return not found" ) ;
11497
115- if ( await _groupService . IsStoreManager ( _contextAccessor . WorkContext . CurrentCustomer ) &&
116- merchandiseReturn . StoreId != _contextAccessor . WorkContext . CurrentCustomer . StaffStoreId )
117- return ErrorForKendoGridJson ( "Merchandise return is not your" ) ;
11898 var items = await _merchandiseReturnViewModelService . PrepareMerchandiseReturnItemModel ( merchandiseReturnId ) ;
11999 var gridModel = new DataSourceResult {
120100 Data = items ,
@@ -133,9 +113,6 @@ public async Task<IActionResult> Edit(string id)
133113 //No merchandise return found with the specified id
134114 return RedirectToAction ( "List" ) ;
135115
136- if ( await _groupService . IsStoreManager ( _contextAccessor . WorkContext . CurrentCustomer ) &&
137- merchandiseReturn . StoreId != _contextAccessor . WorkContext . CurrentCustomer . StaffStoreId )
138- return RedirectToAction ( "List" , "MerchandiseReturn" ) ;
139116 var model = new MerchandiseReturnModel ( ) ;
140117 await _merchandiseReturnViewModelService . PrepareMerchandiseReturnModel ( model , merchandiseReturn , false ) ;
141118 return View ( model ) ;
@@ -155,10 +132,6 @@ [FromServices] OrderSettings orderSettings
155132 //No merchandise return found with the specified id
156133 return RedirectToAction ( "List" ) ;
157134
158- if ( await _groupService . IsStoreManager ( _contextAccessor . WorkContext . CurrentCustomer ) &&
159- merchandiseReturn . StoreId != _contextAccessor . WorkContext . CurrentCustomer . StaffStoreId )
160- return RedirectToAction ( "List" , "MerchandiseReturn" ) ;
161-
162135 if ( ModelState . IsValid )
163136 {
164137 var customAddressAttributes = new List < CustomAttribute > ( ) ;
@@ -191,9 +164,6 @@ public async Task<IActionResult> Delete(string id)
191164 //No merchandise return found with the specified id
192165 return RedirectToAction ( "List" ) ;
193166
194- if ( await _groupService . IsStoreManager ( _contextAccessor . WorkContext . CurrentCustomer ) &&
195- merchandiseReturn . StoreId != _contextAccessor . WorkContext . CurrentCustomer . StaffStoreId )
196- return RedirectToAction ( "List" , "MerchandiseReturn" ) ;
197167 if ( ModelState . IsValid )
198168 {
199169 await _merchandiseReturnViewModelService . DeleteMerchandiseReturn ( merchandiseReturn ) ;
@@ -217,11 +187,8 @@ public async Task<IActionResult> MerchandiseReturnNotesSelect(string merchandise
217187 if ( merchandiseReturn == null )
218188 throw new ArgumentException ( "No merchandise return found with the specified id" ) ;
219189
220- if ( await _groupService . IsStoreManager ( _contextAccessor . WorkContext . CurrentCustomer ) &&
221- merchandiseReturn . StoreId != _contextAccessor . WorkContext . CurrentCustomer . StaffStoreId ) return Content ( "" ) ;
222190 //merchandise return notes
223- var merchandiseReturnNoteModels =
224- await _merchandiseReturnViewModelService . PrepareMerchandiseReturnNotes ( merchandiseReturn ) ;
191+ var merchandiseReturnNoteModels = await _merchandiseReturnViewModelService . PrepareMerchandiseReturnNotes ( merchandiseReturn ) ;
225192 var gridModel = new DataSourceResult {
226193 Data = merchandiseReturnNoteModels ,
227194 Total = merchandiseReturnNoteModels . Count
@@ -241,8 +208,6 @@ public async Task<IActionResult> MerchandiseReturnNoteAdd(string merchandiseRetu
241208 if ( order == null )
242209 return Json ( new { Result = false } ) ;
243210
244- if ( await _groupService . IsStoreManager ( _contextAccessor . WorkContext . CurrentCustomer ) &&
245- merchandiseReturn . StoreId != _contextAccessor . WorkContext . CurrentCustomer . StaffStoreId ) return Json ( new { Result = false } ) ;
246211 await _merchandiseReturnViewModelService . InsertMerchandiseReturnNote ( merchandiseReturn , order , downloadId ,
247212 displayToCustomer , message ) ;
248213
@@ -257,9 +222,6 @@ public async Task<IActionResult> MerchandiseReturnNoteDelete(string id, string m
257222 if ( merchandiseReturn == null )
258223 throw new ArgumentException ( "No merchandise return found with the specified id" ) ;
259224
260- if ( await _groupService . IsStoreManager ( _contextAccessor . WorkContext . CurrentCustomer ) &&
261- merchandiseReturn . StoreId != _contextAccessor . WorkContext . CurrentCustomer . StaffStoreId ) return Json ( new { Result = false } ) ;
262-
263225 await _merchandiseReturnViewModelService . DeleteMerchandiseReturnNote ( merchandiseReturn , id ) ;
264226
265227 return new JsonResult ( "" ) ;
0 commit comments