diff options
author | Rémy Coutable <remy@rymai.me> | 2018-05-16 21:26:22 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-05-16 21:26:22 +0300 |
commit | 6d81905fafb23f20520eb5ffa46c94b18ccc8686 (patch) | |
tree | e265085fa9378a96ddcbae0d51e3f3cdb3de5b8e /app/services | |
parent | c75ae23729771869591b6bc4f1528581d3bfe999 (diff) |
Introduce a new Keys::DestroyService service
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/keys/base_service.rb | 2 | ||||
-rw-r--r-- | app/services/keys/destroy_service.rb | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/app/services/keys/base_service.rb b/app/services/keys/base_service.rb index f78791932a7..df8e82f5f60 100644 --- a/app/services/keys/base_service.rb +++ b/app/services/keys/base_service.rb @@ -2,7 +2,7 @@ module Keys class BaseService attr_accessor :user, :params - def initialize(user, params) + def initialize(user, params = {}) @user, @params = user, params @ip_address = @params.delete(:ip_address) end diff --git a/app/services/keys/destroy_service.rb b/app/services/keys/destroy_service.rb new file mode 100644 index 00000000000..785cfa3a1d8 --- /dev/null +++ b/app/services/keys/destroy_service.rb @@ -0,0 +1,12 @@ +module Keys + class DestroyService < ::Keys::BaseService + def execute(key) + key.destroy if destroy_possible?(key) + end + + # overriden in EE::Keys::DestroyService + def destroy_possible?(key) + true + end + end +end |