Skip to content
Snippets Groups Projects

Add support to configure webhook_timeout in gitlab.yaml

Closed gitlab-qa-bot requested to merge github/fork/wesgurn/master into master
2 files
+ 13
12
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 32
23
@@ -135,7 +135,7 @@ class User < ActiveRecord::Base
@@ -135,7 +135,7 @@ class User < ActiveRecord::Base
# Remove user from all groups
# Remove user from all groups
user.users_groups.find_each do |membership|
user.users_groups.find_each do |membership|
# skip owned resources
# skip owned resources
next if membership.group.owners.include?(user)
next if membership.group.last_owner?(user)
return false unless membership.destroy
return false unless membership.destroy
end
end
@@ -159,6 +159,7 @@ class User < ActiveRecord::Base
@@ -159,6 +159,7 @@ class User < ActiveRecord::Base
scope :not_in_team, ->(team){ where('users.id NOT IN (:ids)', ids: team.member_ids) }
scope :not_in_team, ->(team){ where('users.id NOT IN (:ids)', ids: team.member_ids) }
scope :not_in_project, ->(project) { project.users.present? ? where("id not in (:ids)", ids: project.users.map(&:id) ) : scoped }
scope :not_in_project, ->(project) { project.users.present? ? where("id not in (:ids)", ids: project.users.map(&:id) ) : scoped }
scope :without_projects, -> { where('id NOT IN (SELECT DISTINCT(user_id) FROM users_projects)') }
scope :without_projects, -> { where('id NOT IN (SELECT DISTINCT(user_id) FROM users_projects)') }
 
scope :ldap, -> { where(provider: 'ldap') }
scope :potential_team_members, ->(team) { team.members.any? ? active.not_in_team(team) : active }
scope :potential_team_members, ->(team) { team.members.any? ? active.not_in_team(team) : active }
@@ -166,7 +167,7 @@ class User < ActiveRecord::Base
@@ -166,7 +167,7 @@ class User < ActiveRecord::Base
# Class methods
# Class methods
#
#
class << self
class << self
# Devise method overridden to allow sing in with email or username
# Devise method overridden to allow sign in with email or username
def find_for_database_authentication(warden_conditions)
def find_for_database_authentication(warden_conditions)
conditions = warden_conditions.dup
conditions = warden_conditions.dup
if login = conditions.delete(:login)
if login = conditions.delete(:login)
@@ -186,24 +187,32 @@ class User < ActiveRecord::Base
@@ -186,24 +187,32 @@ class User < ActiveRecord::Base
end
end
end
end
def create_from_omniauth(auth, ldap = false)
def search query
gitlab_auth.create_from_omniauth(auth, ldap)
where("name LIKE :query OR email LIKE :query OR username LIKE :query", query: "%#{query}%")
end
def find_or_new_for_omniauth(auth)
gitlab_auth.find_or_new_for_omniauth(auth)
end
end
def find_for_ldap_auth(auth, signed_in_resource = nil)
def by_username_or_id(name_or_id)
gitlab_auth.find_for_ldap_auth(auth, signed_in_resource)
if (name_or_id.is_a?(Integer))
 
User.find_by_id(name_or_id)
 
else
 
User.find_by_username(name_or_id)
 
end
end
end
def gitlab_auth
def build_user(attrs = {}, options= {})
Gitlab::Auth.new
if options[:as] == :admin
 
User.new(defaults.merge(attrs.symbolize_keys), options)
 
else
 
User.new(attrs, options).with_defaults
 
end
end
end
def search query
def defaults
where("name LIKE :query OR email LIKE :query OR username LIKE :query", query: "%#{query}%")
{
 
projects_limit: Gitlab.config.gitlab.default_projects_limit,
 
can_create_group: Gitlab.config.gitlab.default_can_create_group,
 
theme_id: Gitlab.config.gitlab.default_theme
 
}
end
end
end
end
@@ -215,14 +224,6 @@ class User < ActiveRecord::Base
@@ -215,14 +224,6 @@ class User < ActiveRecord::Base
username
username
end
end
def with_defaults
tap do |u|
u.projects_limit = Gitlab.config.gitlab.default_projects_limit
u.can_create_group = Gitlab.config.gitlab.default_can_create_group
u.theme_id = Gitlab::Theme::MARS
end
end
def notification
def notification
@notification ||= Notification.new(self)
@notification ||= Notification.new(self)
end
end
@@ -329,7 +330,7 @@ class User < ActiveRecord::Base
@@ -329,7 +330,7 @@ class User < ActiveRecord::Base
end
end
def several_namespaces?
def several_namespaces?
namespaces.many?
namespaces.many? || owned_groups.any?
end
end
def namespace_id
def namespace_id
@@ -382,4 +383,12 @@ class User < ActiveRecord::Base
@@ -382,4 +383,12 @@ class User < ActiveRecord::Base
group.owners == [self]
group.owners == [self]
end
end
end
end
 
 
def with_defaults
 
User.defaults.each do |k, v|
 
self.send("#{k}=", v)
 
end
 
 
self
 
end
end
end
Loading