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
a3023011
Commit
a3023011
authored
Jun 14, 2021
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deal with dynamic method dispatch
parent
8f0eabed
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
9 deletions
+21
-9
app/models/integration.rb
app/models/integration.rb
+4
-0
app/models/project.rb
app/models/project.rb
+8
-0
lib/gitlab/auth.rb
lib/gitlab/auth.rb
+8
-8
spec/lib/gitlab/auth_spec.rb
spec/lib/gitlab/auth_spec.rb
+1
-1
No files found.
app/models/integration.rb
View file @
a3023011
...
...
@@ -46,6 +46,10 @@ class Integration < ApplicationRecord
datadog discord drone_ci
]
.
to_set
.
freeze
def
self
.
renamed?
(
name
)
RENAMED_TO_INTEGRATION
.
include?
(
name
)
end
serialize
:properties
,
JSON
# rubocop:disable Cop/ActiveRecordSerialize
attribute
:type
,
Gitlab
::
Integrations
::
StiType
.
new
...
...
app/models/project.rb
View file @
a3023011
...
...
@@ -146,6 +146,14 @@ class Project < ApplicationRecord
has_one
:last_event
,
->
{
order
'events.created_at DESC'
},
class_name:
'Event'
has_many
:boards
def
self
.
integration_association
(
name
)
if
::
Integration
.
renamed?
(
name
)
"
#{
name
}
_integration"
else
"
#{
name
}
_service"
end
end
# Project integrations
has_one
:asana_integration
,
class_name:
'Integrations::Asana'
has_one
:assembla_integration
,
class_name:
'Integrations::Assembla'
...
...
lib/gitlab/auth.rb
View file @
a3023011
...
...
@@ -156,16 +156,16 @@ module Gitlab
underscored_service
=
matched_login
[
'service'
].
underscore
if
Integration
.
available_services_names
.
include?
(
underscored_service
)
return
unless
Integration
.
available_services_names
.
include?
(
underscored_service
)
# We treat underscored_service as a trusted input because it is included
# in the Integration.available_services_names allowlist.
service
=
project
.
public_send
(
"
#{
underscored_service
}
_service"
)
# rubocop:disable GitlabSecurity/PublicSend
service
=
project
.
public_send
(
Project
.
integration_association
(
underscored_service
))
# rubocop:disable GitlabSecurity/PublicSend
return
unless
service
&&
service
.
activated?
&&
service
.
valid_token?
(
password
)
if
service
&&
service
.
activated?
&&
service
.
valid_token?
(
password
)
Gitlab
::
Auth
::
Result
.
new
(
nil
,
project
,
:ci
,
build_authentication_abilities
)
end
end
end
def
user_with_password_for_git
(
login
,
password
)
user
=
find_with_user_password
(
login
,
password
)
...
...
spec/lib/gitlab/auth_spec.rb
View file @
a3023011
...
...
@@ -197,7 +197,7 @@ RSpec.describe Gitlab::Auth, :use_clean_rails_memory_store_caching do
it
'recognizes other ci services'
do
project
.
create_drone_ci_integration
(
active:
true
)
project
.
drone_ci_integration
.
update
!
(
token:
'token'
)
project
.
drone_ci_integration
.
update
(
token:
'token'
)
expect
(
gl_auth
.
find_for_git_client
(
'drone-ci-token'
,
'token'
,
project:
project
,
ip:
'ip'
)).
to
eq
(
Gitlab
::
Auth
::
Result
.
new
(
nil
,
project
,
:ci
,
described_class
.
build_authentication_abilities
))
end
...
...
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