Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
795acf2e
Commit
795acf2e
authored
Sep 20, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move logic to check ci? or lfs_deploy_token? to Gitlab::Auth::Result
parent
242e77e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
app/controllers/projects/git_http_client_controller.rb
app/controllers/projects/git_http_client_controller.rb
+3
-7
app/helpers/lfs_helper.rb
app/helpers/lfs_helper.rb
+1
-1
lib/gitlab/auth/result.rb
lib/gitlab/auth/result.rb
+8
-4
No files found.
app/controllers/projects/git_http_client_controller.rb
View file @
795acf2e
...
...
@@ -127,15 +127,11 @@ class Projects::GitHttpClientController < Projects::ApplicationController
end
def
ci?
authentication_result
.
ci?
&&
authentication_project
&&
authentication_project
==
project
authentication_result
.
ci?
(
project
)
end
def
lfs_deploy_key?
authentication_result
.
lfs_deploy_token?
&&
actor
&&
actor
.
projects
.
include?
(
project
)
def
lfs_deploy_token?
authentication_result
.
lfs_deploy_token?
(
project
)
end
def
authentication_has_download_access?
...
...
app/helpers/lfs_helper.rb
View file @
795acf2e
...
...
@@ -25,7 +25,7 @@ module LfsHelper
def
lfs_download_access?
return
false
unless
project
.
lfs_enabled?
project
.
public?
||
ci?
||
lfs_deploy_
key
?
||
user_can_download_code?
||
build_can_download_code?
project
.
public?
||
ci?
||
lfs_deploy_
token
?
||
user_can_download_code?
||
build_can_download_code?
end
def
user_can_download_code?
...
...
lib/gitlab/auth/result.rb
View file @
795acf2e
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?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment