summaryrefslogtreecommitdiff
path: root/app/models/key.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2012-06-07 15:44:57 +0300
committerDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2012-06-07 15:44:57 +0300
commit0a70aca3b177cffccd2e04579712665d10b8fd69 (patch)
tree28a2e873be1ee3559bcef7f7cfebe19c91e5d3b0 /app/models/key.rb
parent98b841664798d075013fbf132614cc40afc0125e (diff)
downloadgitlab-ce-0a70aca3b177cffccd2e04579712665d10b8fd69.tar.gz
Models Refactoring: Move methods to roles
Diffstat (limited to 'app/models/key.rb')
-rw-r--r--app/models/key.rb20
1 files changed, 2 insertions, 18 deletions
diff --git a/app/models/key.rb b/app/models/key.rb
index 8fe8716cc63..2b05ef55dd8 100644
--- a/app/models/key.rb
+++ b/app/models/key.rb
@@ -1,6 +1,7 @@
require 'digest/md5'
class Key < ActiveRecord::Base
+ include SshKey
belongs_to :user
belongs_to :project
@@ -37,28 +38,11 @@ class Key < ActiveRecord::Base
end
end
- def update_repository
- Gitlab::GitHost.system.new.configure do |c|
- c.update_keys(identifier, key)
- c.update_projects(projects)
- end
- end
-
- def repository_delete_key
- Gitlab::GitHost.system.new.configure do |c|
- #delete key file is there is no identically deploy keys
- if !is_deploy_key || Key.where(:identifier => identifier).count() == 0
- c.delete_key(identifier)
- end
- c.update_projects(projects)
- end
- end
-
def is_deploy_key
true if project_id
end
- #projects that has this key
+ # projects that has this key
def projects
if is_deploy_key
[project]