Class: Admin::PlanLimits::UpdateService
- Inherits:
-
BaseService
- Object
- BaseService
- Admin::PlanLimits::UpdateService
- Defined in:
- app/services/admin/plan_limits/update_service.rb
Instance Attribute Summary
Attributes inherited from BaseService
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(params = {}, current_user:, plan:) ⇒ UpdateService
constructor
A new instance of UpdateService.
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
#initialize(params = {}, current_user:, plan:) ⇒ UpdateService
Returns a new instance of UpdateService.
6 7 8 9 10 11 |
# File 'app/services/admin/plan_limits/update_service.rb', line 6 def initialize(params = {}, current_user:, plan:) @current_user = current_user @params = params @plan = plan @plan_limits = plan.actual_limits end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/services/admin/plan_limits/update_service.rb', line 13 def execute return error(_('Access denied'), :forbidden) unless can_update? add_history_to_params! plan_limits.assign_attributes(parsed_params) validate_storage_limits return error(plan_limits.errors., :bad_request) if plan_limits.errors.any? if plan_limits.update(parsed_params) success else error(plan_limits.errors., :bad_request) end end |