Class: Webauthn::DestroyService
- Inherits:
-
BaseService
- Object
- BaseService
- Webauthn::DestroyService
- Defined in:
- app/services/webauthn/destroy_service.rb
Instance Attribute Summary collapse
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#webauthn_registration ⇒ Object
readonly
Returns the value of attribute webauthn_registration.
Attributes inherited from BaseService
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(current_user, user, webauthn_registrations_id) ⇒ DestroyService
constructor
A new instance of DestroyService.
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(current_user, user, webauthn_registrations_id) ⇒ DestroyService
Returns a new instance of DestroyService.
7 8 9 10 11 |
# File 'app/services/webauthn/destroy_service.rb', line 7 def initialize(current_user, user, webauthn_registrations_id) @current_user = current_user @user = user @webauthn_registration = user.webauthn_registrations.find(webauthn_registrations_id) end |
Instance Attribute Details
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
5 6 7 |
# File 'app/services/webauthn/destroy_service.rb', line 5 def current_user @current_user end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'app/services/webauthn/destroy_service.rb', line 5 def user @user end |
#webauthn_registration ⇒ Object (readonly)
Returns the value of attribute webauthn_registration.
5 6 7 |
# File 'app/services/webauthn/destroy_service.rb', line 5 def webauthn_registration @webauthn_registration end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 18 |
# File 'app/services/webauthn/destroy_service.rb', line 13 def execute return error(_('You are not authorized to perform this action')) unless webauthn_registration.destroy user.reset_backup_codes! if last_two_factor_registration? end |