Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-09-20 11:24:47 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-09-20 12:03:10 +0300
commit795acf2e4e01f7ddf3a8be73ddc119b4d84a03e3 (patch)
tree1734323e1a55b7be520e79d7e1f40acaad438456 /lib/gitlab/auth
parent242e77e070c25fd45896bdd7be6edac4679ec2b2 (diff)
Move logic to check ci? or lfs_deploy_token? to Gitlab::Auth::Result
Diffstat (limited to 'lib/gitlab/auth')
-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?