summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2018-03-29 16:56:35 -0600
committerMayra Cabrera <mcabrera@gitlab.com>2018-04-06 21:20:16 -0500
commit370fc05da7f95bf6621867a71d51493cf3899e25 (patch)
tree040f676c8c6ccf04d5ebfdbbe064a844affd63f5 /app
parentdb18993f652425b72c4b854e18a002e0ec44b196 (diff)
downloadgitlab-ce-370fc05da7f95bf6621867a71d51493cf3899e25.tar.gz
Implement 'read_repo' for DeployTokens
This will allow to download a repo using the token from the DeployToken
Diffstat (limited to 'app')
-rw-r--r--app/models/deploy_token.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/deploy_token.rb b/app/models/deploy_token.rb
index 185bd806b18..089b4343f41 100644
--- a/app/models/deploy_token.rb
+++ b/app/models/deploy_token.rb
@@ -22,4 +22,12 @@ class DeployToken < ActiveRecord::Base
def self.redis_shared_state_key(user_id)
"gitlab:personal_access_token:#{user_id}"
end
+
+ def active?
+ !revoked
+ end
+
+ def username
+ User.ghost.username
+ end
end