Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab FOSS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab FOSS
Commits
dc296854
There was a problem fetching the pipeline summary.
Commit
dc296854
authored
8 years ago
by
Kamil Trzciński
Browse files
Options
Downloads
Patches
Plain Diff
Properly support Gitlab::Auth::Result
parent
6d43c95b
No related branches found
No related tags found
1 merge request
!6409
Make CI to use the permission of the user who is trigger the build
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/gitlab/auth.rb
+7
-7
7 additions, 7 deletions
lib/gitlab/auth.rb
lib/gitlab/auth/result.rb
+1
-1
1 addition, 1 deletion
lib/gitlab/auth/result.rb
with
8 additions
and
8 deletions
lib/gitlab/auth.rb
+
7
−
7
View file @
dc296854
...
...
@@ -12,7 +12,7 @@ def find_for_git_client(login, password, project:, ip:)
user_with_password_for_git
(
login
,
password
)
||
oauth_access_token_check
(
login
,
password
)
||
personal_access_token_check
(
login
,
password
)
||
Result
.
new
Gitlab
::
Auth
::
Result
.
new
rate_limit!
(
ip
,
success:
result
.
success?
,
login:
login
)
...
...
@@ -70,7 +70,7 @@ def service_request_check(login, password, project)
service
=
project
.
public_send
(
"
#{
underscored_service
}
_service"
)
if
service
&&
service
.
activated?
&&
service
.
valid_token?
(
password
)
Result
.
new
(
nil
,
project
,
:ci
,
build_authentication_abilities
)
Gitlab
::
Auth
::
Result
.
new
(
nil
,
project
,
:ci
,
build_authentication_abilities
)
end
end
end
...
...
@@ -81,7 +81,7 @@ def user_with_password_for_git(login, password)
raise
Gitlab
::
Auth
::
MissingPersonalTokenError
if
user
.
two_factor_enabled?
Result
.
new
(
user
,
nil
,
:gitlab_or_ldap
,
full_authentication_abilities
)
Gitlab
::
Auth
::
Result
.
new
(
user
,
nil
,
:gitlab_or_ldap
,
full_authentication_abilities
)
end
def
oauth_access_token_check
(
login
,
password
)
...
...
@@ -89,7 +89,7 @@ def oauth_access_token_check(login, password)
token
=
Doorkeeper
::
AccessToken
.
by_token
(
password
)
if
token
&&
token
.
accessible?
user
=
User
.
find_by
(
id:
token
.
resource_owner_id
)
Result
.
new
(
user
,
nil
,
:oauth
,
read_authentication_abilities
)
Gitlab
::
Auth
::
Result
.
new
(
user
,
nil
,
:oauth
,
read_authentication_abilities
)
end
end
end
...
...
@@ -98,7 +98,7 @@ def personal_access_token_check(login, password)
if
login
&&
password
user
=
User
.
find_by_personal_access_token
(
password
)
validation
=
User
.
by_login
(
login
)
Result
.
new
(
user
,
nil
,
:personal_token
,
full_authentication_abilities
)
if
user
.
present?
&&
user
==
validation
Gitlab
::
Auth
::
Result
.
new
(
user
,
nil
,
:personal_token
,
full_authentication_abilities
)
if
user
.
present?
&&
user
==
validation
end
end
...
...
@@ -112,10 +112,10 @@ def build_access_token_check(login, password)
if
build
.
user
# If user is assigned to build, use restricted credentials of user
Result
.
new
(
build
.
user
,
build
.
project
,
:build
,
build_authentication_abilities
)
Gitlab
::
Auth
::
Result
.
new
(
build
.
user
,
build
.
project
,
:build
,
build_authentication_abilities
)
else
# Otherwise use generic CI credentials (backward compatibility)
Result
.
new
(
nil
,
build
.
project
,
:ci
,
build_authentication_abilities
)
Gitlab
::
Auth
::
Result
.
new
(
nil
,
build
.
project
,
:ci
,
build_authentication_abilities
)
end
end
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/auth/result.rb
+
1
−
1
View file @
dc296854
module
Gitlab
module
Auth
Result
=
Struct
.
new
(
:actor
,
:project
,
:type
,
:authentication_abilities
)
do
class
Result
<
Struct
.
new
(
:actor
,
:project
,
:type
,
:authentication_abilities
)
def
ci?
type
==
:ci
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment