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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
795acf2e
Commit
795acf2e
authored
8 years ago
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
...
@@ -127,15 +127,11 @@ class Projects::GitHttpClientController < Projects::ApplicationController
end
end
def
ci?
def
ci?
authentication_result
.
ci?
&&
authentication_result
.
ci?
(
project
)
authentication_project
&&
authentication_project
==
project
end
end
def
lfs_deploy_key?
def
lfs_deploy_token?
authentication_result
.
lfs_deploy_token?
&&
authentication_result
.
lfs_deploy_token?
(
project
)
actor
&&
actor
.
projects
.
include?
(
project
)
end
end
def
authentication_has_download_access?
def
authentication_has_download_access?
...
...
This diff is collapsed.
Click to expand it.
app/helpers/lfs_helper.rb
View file @
795acf2e
...
@@ -25,7 +25,7 @@ module LfsHelper
...
@@ -25,7 +25,7 @@ module LfsHelper
def
lfs_download_access?
def
lfs_download_access?
return
false
unless
project
.
lfs_enabled?
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
end
def
user_can_download_code?
def
user_can_download_code?
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/auth/result.rb
View file @
795acf2e
module
Gitlab
module
Gitlab
module
Auth
module
Auth
Result
=
Struct
.
new
(
:actor
,
:project
,
:type
,
:authentication_abilities
)
do
Result
=
Struct
.
new
(
:actor
,
:project
,
:type
,
:authentication_abilities
)
do
def
ci?
def
ci?
(
for_project
)
type
==
:ci
type
==
:ci
&&
project
&&
project
==
for_project
end
end
def
lfs_deploy_token?
def
lfs_deploy_token?
(
for_project
)
type
==
:lfs_deploy_token
type
==
:lfs_deploy_token
&&
actor
&&
actor
.
projects
.
include?
(
for_project
)
end
end
def
success?
def
success?
...
...
This diff is collapsed.
Click to expand it.
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