summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-09-20 10:24:47 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-09-20 11:03:10 +0200
commit795acf2e4e01f7ddf3a8be73ddc119b4d84a03e3 (patch)
tree1734323e1a55b7be520e79d7e1f40acaad438456 /lib
parent242e77e070c25fd45896bdd7be6edac4679ec2b2 (diff)
downloadgitlab-ce-795acf2e4e01f7ddf3a8be73ddc119b4d84a03e3.tar.gz
Move logic to check ci? or lfs_deploy_token? to Gitlab::Auth::Result
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/auth/result.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/gitlab/auth/result.rb b/lib/gitlab/auth/result.rb
index e4786b12676..6be7f690676 100644
--- a/lib/gitlab/auth/result.rb
+++ b/lib/gitlab/auth/result.rb
@@ -1,12 +1,16 @@
module Gitlab
module Auth
Result = Struct.new(:actor, :project, :type, :authentication_abilities) do
- def ci?
- type == :ci
+ def ci?(for_project)
+ type == :ci &&
+ project &&
+ project == for_project
end
- def lfs_deploy_token?
- type == :lfs_deploy_token
+ def lfs_deploy_token?(for_project)
+ type == :lfs_deploy_token &&
+ actor &&
+ actor.projects.include?(for_project)
end
def success?