@@ -175,7 +175,7 @@ public IActionResult VehicleInfo(int vehicleId)
175175 List < Vehicle > vehicles = new List < Vehicle > ( ) ;
176176 if ( vehicleId != default )
177177 {
178- if ( _userLogic . UserCanEditVehicle ( GetUserID ( ) , vehicleId ) )
178+ if ( _userLogic . UserCanEditVehicle ( GetUserID ( ) , vehicleId , HouseholdPermission . View ) )
179179 {
180180 vehicles . Add ( _dataAccess . GetVehicleById ( vehicleId ) ) ;
181181 } else
@@ -351,7 +351,7 @@ public IActionResult DeletePlanRecord(int id)
351351 return Json ( OperationResponse . Failed ( "Invalid Record Id" ) ) ;
352352 }
353353 //security check.
354- if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId ) )
354+ if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId , HouseholdPermission . Delete ) )
355355 {
356356 Response . StatusCode = 401 ;
357357 return Json ( OperationResponse . Failed ( "Access Denied, you don't have access to this vehicle." ) ) ;
@@ -419,7 +419,7 @@ public IActionResult UpdatePlanRecord(PlanRecordExportModel input)
419419 if ( existingRecord != null && existingRecord . Id == int . Parse ( input . Id ) )
420420 {
421421 //check if user has access to the vehicleId
422- if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId ) )
422+ if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId , HouseholdPermission . Edit ) )
423423 {
424424 Response . StatusCode = 401 ;
425425 return Json ( OperationResponse . Failed ( "Access Denied, you don't have access to this vehicle." ) ) ;
@@ -567,7 +567,7 @@ public IActionResult DeleteServiceRecord(int id)
567567 return Json ( OperationResponse . Failed ( "Invalid Record Id" ) ) ;
568568 }
569569 //security check.
570- if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId ) )
570+ if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId , HouseholdPermission . Delete ) )
571571 {
572572 Response . StatusCode = 401 ;
573573 return Json ( OperationResponse . Failed ( "Access Denied, you don't have access to this vehicle." ) ) ;
@@ -616,7 +616,7 @@ public IActionResult UpdateServiceRecord(GenericRecordExportModel input)
616616 if ( existingRecord != null && existingRecord . Id == int . Parse ( input . Id ) )
617617 {
618618 //check if user has access to the vehicleId
619- if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId ) )
619+ if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId , HouseholdPermission . Edit ) )
620620 {
621621 Response . StatusCode = 401 ;
622622 return Json ( OperationResponse . Failed ( "Access Denied, you don't have access to this vehicle." ) ) ;
@@ -764,7 +764,7 @@ public IActionResult DeleteRepairRecord(int id)
764764 return Json ( OperationResponse . Failed ( "Invalid Record Id" ) ) ;
765765 }
766766 //security check.
767- if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId ) )
767+ if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId , HouseholdPermission . Delete ) )
768768 {
769769 Response . StatusCode = 401 ;
770770 return Json ( OperationResponse . Failed ( "Access Denied, you don't have access to this vehicle." ) ) ;
@@ -813,7 +813,7 @@ public IActionResult UpdateRepairRecord(GenericRecordExportModel input)
813813 if ( existingRecord != null && existingRecord . Id == int . Parse ( input . Id ) )
814814 {
815815 //check if user has access to the vehicleId
816- if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId ) )
816+ if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId , HouseholdPermission . Edit ) )
817817 {
818818 Response . StatusCode = 401 ;
819819 return Json ( OperationResponse . Failed ( "Access Denied, you don't have access to this vehicle." ) ) ;
@@ -961,7 +961,7 @@ public IActionResult DeleteUpgradeRecord(int id)
961961 return Json ( OperationResponse . Failed ( "Invalid Record Id" ) ) ;
962962 }
963963 //security check.
964- if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId ) )
964+ if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId , HouseholdPermission . Delete ) )
965965 {
966966 Response . StatusCode = 401 ;
967967 return Json ( OperationResponse . Failed ( "Access Denied, you don't have access to this vehicle." ) ) ;
@@ -1010,7 +1010,7 @@ public IActionResult UpdateUpgradeRecord(GenericRecordExportModel input)
10101010 if ( existingRecord != null && existingRecord . Id == int . Parse ( input . Id ) )
10111011 {
10121012 //check if user has access to the vehicleId
1013- if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId ) )
1013+ if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId , HouseholdPermission . Edit ) )
10141014 {
10151015 Response . StatusCode = 401 ;
10161016 return Json ( OperationResponse . Failed ( "Access Denied, you don't have access to this vehicle." ) ) ;
@@ -1180,7 +1180,7 @@ public IActionResult DeleteTaxRecord(int id)
11801180 return Json ( OperationResponse . Failed ( "Invalid Record Id" ) ) ;
11811181 }
11821182 //security check.
1183- if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId ) )
1183+ if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId , HouseholdPermission . Delete ) )
11841184 {
11851185 Response . StatusCode = 401 ;
11861186 return Json ( OperationResponse . Failed ( "Access Denied, you don't have access to this vehicle." ) ) ;
@@ -1223,7 +1223,7 @@ public IActionResult UpdateTaxRecord(TaxRecordExportModel input)
12231223 if ( existingRecord != null && existingRecord . Id == int . Parse ( input . Id ) )
12241224 {
12251225 //check if user has access to the vehicleId
1226- if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId ) )
1226+ if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId , HouseholdPermission . Edit ) )
12271227 {
12281228 Response . StatusCode = 401 ;
12291229 return Json ( OperationResponse . Failed ( "Access Denied, you don't have access to this vehicle." ) ) ;
@@ -1373,7 +1373,7 @@ public IActionResult DeleteOdometerRecord(int id)
13731373 return Json ( OperationResponse . Failed ( "Invalid Record Id" ) ) ;
13741374 }
13751375 //security check.
1376- if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId ) )
1376+ if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId , HouseholdPermission . Delete ) )
13771377 {
13781378 Response . StatusCode = 401 ;
13791379 return Json ( OperationResponse . Failed ( "Access Denied, you don't have access to this vehicle." ) ) ;
@@ -1416,7 +1416,7 @@ public IActionResult UpdateOdometerRecord(OdometerRecordExportModel input)
14161416 if ( existingRecord != null && existingRecord . Id == int . Parse ( input . Id ) )
14171417 {
14181418 //check if user has access to the vehicleId
1419- if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId ) )
1419+ if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId , HouseholdPermission . Edit ) )
14201420 {
14211421 Response . StatusCode = 401 ;
14221422 return Json ( OperationResponse . Failed ( "Access Denied, you don't have access to this vehicle." ) ) ;
@@ -1583,7 +1583,7 @@ public IActionResult DeleteGasRecord(int id)
15831583 return Json ( OperationResponse . Failed ( "Invalid Record Id" ) ) ;
15841584 }
15851585 //security check.
1586- if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId ) )
1586+ if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId , HouseholdPermission . Delete ) )
15871587 {
15881588 Response . StatusCode = 401 ;
15891589 return Json ( OperationResponse . Failed ( "Access Denied, you don't have access to this vehicle." ) ) ;
@@ -1629,7 +1629,7 @@ public IActionResult UpdateGasRecord(GasRecordExportModel input)
16291629 if ( existingRecord != null && existingRecord . Id == int . Parse ( input . Id ) )
16301630 {
16311631 //check if user has access to the vehicleId
1632- if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId ) )
1632+ if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId , HouseholdPermission . Edit ) )
16331633 {
16341634 Response . StatusCode = 401 ;
16351635 return Json ( OperationResponse . Failed ( "Access Denied, you don't have access to this vehicle." ) ) ;
@@ -1823,7 +1823,7 @@ public IActionResult UpdateReminderRecord(ReminderExportModel input)
18231823 if ( existingRecord != null && existingRecord . Id == int . Parse ( input . Id ) )
18241824 {
18251825 //check if user has access to the vehicleId
1826- if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId ) )
1826+ if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId , HouseholdPermission . Edit ) )
18271827 {
18281828 Response . StatusCode = 401 ;
18291829 return Json ( OperationResponse . Failed ( "Access Denied, you don't have access to this vehicle." ) ) ;
@@ -1861,7 +1861,7 @@ public IActionResult DeleteReminderRecord(int id)
18611861 return Json ( OperationResponse . Failed ( "Invalid Record Id" ) ) ;
18621862 }
18631863 //security check.
1864- if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId ) )
1864+ if ( ! _userLogic . UserCanEditVehicle ( GetUserID ( ) , existingRecord . VehicleId , HouseholdPermission . Delete ) )
18651865 {
18661866 Response . StatusCode = 401 ;
18671867 return Json ( OperationResponse . Failed ( "Access Denied, you don't have access to this vehicle." ) ) ;
0 commit comments