summaryrefslogtreecommitdiff
path: root/lib/gitlab/lfs_token.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-09-19 13:38:58 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-09-19 13:45:28 +0200
commit6d43c95b7011ec7ec4600e00bdc8df76bb39813c (patch)
treef9ee7a65904f14286d302d1af51add94922fb50d /lib/gitlab/lfs_token.rb
parent79f60e2b5cf388416cdc5948e19ae0401f97d353 (diff)
downloadgitlab-ce-6d43c95b7011ec7ec4600e00bdc8df76bb39813c.tar.gz
Revert all changes introduced by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6043
Diffstat (limited to 'lib/gitlab/lfs_token.rb')
-rw-r--r--lib/gitlab/lfs_token.rb54
1 files changed, 0 insertions, 54 deletions
diff --git a/lib/gitlab/lfs_token.rb b/lib/gitlab/lfs_token.rb
deleted file mode 100644
index d089a2f9b0b..00000000000
--- a/lib/gitlab/lfs_token.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-module Gitlab
- class LfsToken
- attr_accessor :actor
-
- TOKEN_LENGTH = 50
- EXPIRY_TIME = 1800
-
- def initialize(actor)
- @actor =
- case actor
- when DeployKey, User
- actor
- when Key
- actor.user
- else
- raise 'Bad Actor'
- end
- end
-
- def generate
- token = Devise.friendly_token(TOKEN_LENGTH)
-
- Gitlab::Redis.with do |redis|
- redis.set(redis_key, token, ex: EXPIRY_TIME)
- end
-
- token
- end
-
- def value
- Gitlab::Redis.with do |redis|
- redis.get(redis_key)
- end
- end
-
- def user?
- actor.is_a?(User)
- end
-
- def type
- actor.is_a?(User) ? :lfs_token : :lfs_deploy_token
- end
-
- def actor_name
- actor.is_a?(User) ? actor.username : "lfs+deploy-key-#{actor.id}"
- end
-
- private
-
- def redis_key
- "gitlab:lfs_token:#{actor.class.name.underscore}_#{actor.id}" if actor
- end
- end
-end