Fixing port conflicts

parent 08b45fc9
...@@ -6,13 +6,10 @@ module AuthHelper ...@@ -6,13 +6,10 @@ module AuthHelper
def ldap_enabled? def ldap_enabled?
Gitlab::Auth::LDAP::Config.enabled? Gitlab::Auth::LDAP::Config.enabled?
<<<<<<< HEAD
end end
def kerberos_enabled? def kerberos_enabled?
auth_providers.include?(:kerberos) auth_providers.include?(:kerberos)
=======
>>>>>>> upstream/master
end end
def omniauth_enabled? def omniauth_enabled?
......
...@@ -6,11 +6,7 @@ module Gitlab ...@@ -6,11 +6,7 @@ module Gitlab
module Auth module Auth
module LDAP module LDAP
class Access class Access
<<<<<<< HEAD
attr_reader :provider, :user, :ldap_identity attr_reader :provider, :user, :ldap_identity
=======
attr_reader :provider, :user
>>>>>>> upstream/master
def self.open(user, &block) def self.open(user, &block)
Gitlab::Auth::LDAP::Adapter.open(user.ldap_identity.provider) do |adapter| Gitlab::Auth::LDAP::Adapter.open(user.ldap_identity.provider) do |adapter|
...@@ -18,18 +14,12 @@ module Gitlab ...@@ -18,18 +14,12 @@ module Gitlab
end end
end end
<<<<<<< HEAD
def self.allowed?(user, options = {}) def self.allowed?(user, options = {})
self.open(user) do |access| self.open(user) do |access|
# Whether user is allowed, or not, we should update # Whether user is allowed, or not, we should update
# permissions to keep things clean # permissions to keep things clean
if access.allowed? if access.allowed?
access.update_user access.update_user
=======
def self.allowed?(user)
self.open(user) do |access|
if access.allowed?
>>>>>>> upstream/master
Users::UpdateService.new(user, user: user, last_credential_check_at: Time.now).execute Users::UpdateService.new(user, user: user, last_credential_check_at: Time.now).execute
true true
...@@ -42,12 +32,8 @@ module Gitlab ...@@ -42,12 +32,8 @@ module Gitlab
def initialize(user, adapter = nil) def initialize(user, adapter = nil)
@adapter = adapter @adapter = adapter
@user = user @user = user
<<<<<<< HEAD
@ldap_identity = user.ldap_identity @ldap_identity = user.ldap_identity
@provider = adapter&.provider || @ldap_identity&.provider @provider = adapter&.provider || @ldap_identity&.provider
=======
@provider = user.ldap_identity.provider
>>>>>>> upstream/master
end end
def allowed? def allowed?
...@@ -58,11 +44,7 @@ module Gitlab ...@@ -58,11 +44,7 @@ module Gitlab
end end
# Block user in GitLab if he/she was blocked in AD # Block user in GitLab if he/she was blocked in AD
<<<<<<< HEAD
if Gitlab::Auth::LDAP::Person.disabled_via_active_directory?(ldap_identity.extern_uid, adapter) if Gitlab::Auth::LDAP::Person.disabled_via_active_directory?(ldap_identity.extern_uid, adapter)
=======
if Gitlab::Auth::LDAP::Person.disabled_via_active_directory?(user.ldap_identity.extern_uid, adapter)
>>>>>>> upstream/master
block_user(user, 'is disabled in Active Directory') block_user(user, 'is disabled in Active Directory')
false false
else else
...@@ -84,7 +66,6 @@ module Gitlab ...@@ -84,7 +66,6 @@ module Gitlab
Gitlab::Auth::LDAP::Config.new(provider) Gitlab::Auth::LDAP::Config.new(provider)
end end
<<<<<<< HEAD
def find_ldap_user def find_ldap_user
return unless provider return unless provider
...@@ -98,16 +79,11 @@ module Gitlab ...@@ -98,16 +79,11 @@ module Gitlab
def ldap_user def ldap_user
@ldap_user ||= find_ldap_user @ldap_user ||= find_ldap_user
=======
def ldap_user
@ldap_user ||= Gitlab::Auth::LDAP::Person.find_by_dn(user.ldap_identity.extern_uid, adapter)
>>>>>>> upstream/master
end end
def block_user(user, reason) def block_user(user, reason)
user.ldap_block user.ldap_block
<<<<<<< HEAD
if provider if provider
Gitlab::AppLogger.info( Gitlab::AppLogger.info(
"LDAP account \"#{ldap_identity.extern_uid}\" #{reason}, " \ "LDAP account \"#{ldap_identity.extern_uid}\" #{reason}, " \
...@@ -119,19 +95,12 @@ module Gitlab ...@@ -119,19 +95,12 @@ module Gitlab
"blocking Gitlab user \"#{user.name}\" (#{user.email})" "blocking Gitlab user \"#{user.name}\" (#{user.email})"
) )
end end
=======
Gitlab::AppLogger.info(
"LDAP account \"#{user.ldap_identity.extern_uid}\" #{reason}, " \
"blocking Gitlab user \"#{user.name}\" (#{user.email})"
)
>>>>>>> upstream/master
end end
def unblock_user(user, reason) def unblock_user(user, reason)
user.activate user.activate
Gitlab::AppLogger.info( Gitlab::AppLogger.info(
<<<<<<< HEAD
"LDAP account \"#{ldap_identity.extern_uid}\" #{reason}, " \ "LDAP account \"#{ldap_identity.extern_uid}\" #{reason}, " \
"unblocking Gitlab user \"#{user.name}\" (#{user.email})" "unblocking Gitlab user \"#{user.name}\" (#{user.email})"
) )
...@@ -241,12 +210,6 @@ module Gitlab ...@@ -241,12 +210,6 @@ module Gitlab
def logger def logger
Rails.logger Rails.logger
end end
=======
"LDAP account \"#{user.ldap_identity.extern_uid}\" #{reason}, " \
"unblocking Gitlab user \"#{user.name}\" (#{user.email})"
)
end
>>>>>>> upstream/master
end end
end end
end end
......
...@@ -2,11 +2,8 @@ module Gitlab ...@@ -2,11 +2,8 @@ module Gitlab
module Auth module Auth
module LDAP module LDAP
class Adapter class Adapter
<<<<<<< HEAD
prepend ::EE::Gitlab::Auth::LDAP::Adapter prepend ::EE::Gitlab::Auth::LDAP::Adapter
=======
>>>>>>> upstream/master
attr_reader :provider, :ldap attr_reader :provider, :ldap
def self.open(provider, &block) def self.open(provider, &block)
......
...@@ -3,11 +3,8 @@ module Gitlab ...@@ -3,11 +3,8 @@ module Gitlab
module Auth module Auth
module LDAP module LDAP
class Config class Config
<<<<<<< HEAD
include ::EE::Gitlab::Auth::LDAP::Config include ::EE::Gitlab::Auth::LDAP::Config
=======
>>>>>>> upstream/master
NET_LDAP_ENCRYPTION_METHOD = { NET_LDAP_ENCRYPTION_METHOD = {
simple_tls: :simple_tls, simple_tls: :simple_tls,
start_tls: :start_tls, start_tls: :start_tls,
...@@ -16,11 +13,8 @@ module Gitlab ...@@ -16,11 +13,8 @@ module Gitlab
attr_accessor :provider, :options attr_accessor :provider, :options
<<<<<<< HEAD
InvalidProvider = Class.new(StandardError) InvalidProvider = Class.new(StandardError)
=======
>>>>>>> upstream/master
def self.enabled? def self.enabled?
Gitlab.config.ldap.enabled Gitlab.config.ldap.enabled
end end
...@@ -32,11 +26,7 @@ module Gitlab ...@@ -32,11 +26,7 @@ module Gitlab
def self.available_servers def self.available_servers
return [] unless enabled? return [] unless enabled?
<<<<<<< HEAD
::License.feature_available?(:multiple_ldap_servers) ? servers : Array.wrap(servers.first) ::License.feature_available?(:multiple_ldap_servers) ? servers : Array.wrap(servers.first)
=======
Array.wrap(servers.first)
>>>>>>> upstream/master
end end
def self.providers def self.providers
...@@ -48,11 +38,7 @@ module Gitlab ...@@ -48,11 +38,7 @@ module Gitlab
end end
def self.invalid_provider(provider) def self.invalid_provider(provider)
<<<<<<< HEAD
raise InvalidProvider.new("Unknown provider (#{provider}). Available providers: #{providers}") raise InvalidProvider.new("Unknown provider (#{provider}). Available providers: #{providers}")
=======
raise "Unknown provider (#{provider}). Available providers: #{providers}"
>>>>>>> upstream/master
end end
def initialize(provider) def initialize(provider)
...@@ -102,24 +88,17 @@ module Gitlab ...@@ -102,24 +88,17 @@ module Gitlab
end end
def base def base
<<<<<<< HEAD
@base ||= Person.normalize_dn(options['base']) @base ||= Person.normalize_dn(options['base'])
=======
options['base']
>>>>>>> upstream/master
end end
def uid def uid
options['uid'] options['uid']
end end
<<<<<<< HEAD
def label def label
options['label'] options['label']
end end
=======
>>>>>>> upstream/master
def sync_ssh_keys? def sync_ssh_keys?
sync_ssh_keys.present? sync_ssh_keys.present?
end end
...@@ -161,13 +140,10 @@ module Gitlab ...@@ -161,13 +140,10 @@ module Gitlab
options['timeout'].to_i options['timeout'].to_i
end end
<<<<<<< HEAD
def external_groups def external_groups
options['external_groups'] options['external_groups']
end end
=======
>>>>>>> upstream/master
def has_auth? def has_auth?
options['password'] || options['bind_dn'] options['password'] || options['bind_dn']
end end
......
<<<<<<< HEAD
# Contains methods common to both GitLab CE and EE. # Contains methods common to both GitLab CE and EE.
# All EE methods should be in `EE::Gitlab::Auth::LDAP::Person` only. # All EE methods should be in `EE::Gitlab::Auth::LDAP::Person` only.
=======
>>>>>>> upstream/master
module Gitlab module Gitlab
module Auth module Auth
module LDAP module LDAP
class Person class Person
<<<<<<< HEAD
prepend ::EE::Gitlab::Auth::LDAP::Person prepend ::EE::Gitlab::Auth::LDAP::Person
=======
>>>>>>> upstream/master
# Active Directory-specific LDAP filter that checks if bit 2 of the # Active Directory-specific LDAP filter that checks if bit 2 of the
# userAccountControl attribute is set. # userAccountControl attribute is set.
# Source: http://ctogonewild.com/2009/09/03/bitmask-searches-in-ldap/ # Source: http://ctogonewild.com/2009/09/03/bitmask-searches-in-ldap/
......
...@@ -8,11 +8,8 @@ module Gitlab ...@@ -8,11 +8,8 @@ module Gitlab
module Auth module Auth
module LDAP module LDAP
class User < Gitlab::Auth::OAuth::User class User < Gitlab::Auth::OAuth::User
<<<<<<< HEAD
prepend ::EE::Gitlab::Auth::LDAP::User prepend ::EE::Gitlab::Auth::LDAP::User
=======
>>>>>>> upstream/master
class << self class << self
def find_by_uid_and_provider(uid, provider) def find_by_uid_and_provider(uid, provider)
identity = ::Identity.with_extern_uid(provider, uid).take identity = ::Identity.with_extern_uid(provider, uid).take
......
...@@ -4,11 +4,8 @@ module Gitlab ...@@ -4,11 +4,8 @@ module Gitlab
module Auth module Auth
module OAuth module OAuth
class AuthHash class AuthHash
<<<<<<< HEAD
prepend ::EE::Gitlab::Auth::OAuth::AuthHash prepend ::EE::Gitlab::Auth::OAuth::AuthHash
=======
>>>>>>> upstream/master
attr_reader :auth_hash attr_reader :auth_hash
def initialize(auth_hash) def initialize(auth_hash)
@auth_hash = auth_hash @auth_hash = auth_hash
......
...@@ -7,11 +7,8 @@ module Gitlab ...@@ -7,11 +7,8 @@ module Gitlab
module Auth module Auth
module OAuth module OAuth
class User class User
<<<<<<< HEAD
prepend ::EE::Gitlab::Auth::OAuth::User prepend ::EE::Gitlab::Auth::OAuth::User
=======
>>>>>>> upstream/master
SignupDisabledError = Class.new(StandardError) SignupDisabledError = Class.new(StandardError)
SigninDisabledForProviderError = Class.new(StandardError) SigninDisabledForProviderError = Class.new(StandardError)
......
...@@ -14,7 +14,6 @@ module Gitlab ...@@ -14,7 +14,6 @@ module Gitlab
def external_groups def external_groups
options[:external_groups] options[:external_groups]
end end
<<<<<<< HEAD
def required_groups def required_groups
Array(options[:required_groups]) Array(options[:required_groups])
...@@ -23,8 +22,6 @@ module Gitlab ...@@ -23,8 +22,6 @@ module Gitlab
def admin_groups def admin_groups
options[:admin_groups] options[:admin_groups]
end end
=======
>>>>>>> upstream/master
end end
end end
end end
......
...@@ -18,7 +18,6 @@ module Gitlab ...@@ -18,7 +18,6 @@ module Gitlab
user ||= find_or_build_ldap_user if auto_link_ldap_user? user ||= find_or_build_ldap_user if auto_link_ldap_user?
user ||= build_new_user if signup_enabled? user ||= build_new_user if signup_enabled?
<<<<<<< HEAD
if user_in_required_group? if user_in_required_group?
unblock_user(user, "in required group") if user.persisted? && user.blocked? unblock_user(user, "in required group") if user.persisted? && user.blocked?
elsif user.persisted? elsif user.persisted?
...@@ -30,12 +29,6 @@ module Gitlab ...@@ -30,12 +29,6 @@ module Gitlab
if user if user
user.external = !(auth_hash.groups & Gitlab::Auth::Saml::Config.external_groups).empty? if external_users_enabled? user.external = !(auth_hash.groups & Gitlab::Auth::Saml::Config.external_groups).empty? if external_users_enabled?
user.admin = !(auth_hash.groups & Gitlab::Auth::Saml::Config.admin_groups).empty? if admin_groups_enabled? user.admin = !(auth_hash.groups & Gitlab::Auth::Saml::Config.admin_groups).empty? if admin_groups_enabled?
=======
if external_users_enabled? && user
# Check if there is overlap between the user's groups and the external groups
# setting then set user as external or internal.
user.external = !(auth_hash.groups & Gitlab::Auth::Saml::Config.external_groups).empty?
>>>>>>> upstream/master
end end
user user
...@@ -49,7 +42,6 @@ module Gitlab ...@@ -49,7 +42,6 @@ module Gitlab
protected protected
<<<<<<< HEAD
def block_user(user, reason) def block_user(user, reason)
user.ldap_block user.ldap_block
log_user_changes(user, "#{reason}, blocking") log_user_changes(user, "#{reason}, blocking")
...@@ -72,8 +64,6 @@ module Gitlab ...@@ -72,8 +64,6 @@ module Gitlab
required_groups.empty? || !(auth_hash.groups & required_groups).empty? required_groups.empty? || !(auth_hash.groups & required_groups).empty?
end end
=======
>>>>>>> upstream/master
def auto_link_saml_user? def auto_link_saml_user?
Gitlab.config.omniauth.auto_link_saml_user Gitlab.config.omniauth.auto_link_saml_user
end end
...@@ -85,13 +75,10 @@ module Gitlab ...@@ -85,13 +75,10 @@ module Gitlab
def auth_hash=(auth_hash) def auth_hash=(auth_hash)
@auth_hash = Gitlab::Auth::Saml::AuthHash.new(auth_hash) @auth_hash = Gitlab::Auth::Saml::AuthHash.new(auth_hash)
end end
<<<<<<< HEAD
def admin_groups_enabled? def admin_groups_enabled?
!Gitlab::Auth::Saml::Config.admin_groups.nil? !Gitlab::Auth::Saml::Config.admin_groups.nil?
end end
=======
>>>>>>> upstream/master
end end
end end
end end
......
This diff is collapsed.
...@@ -26,7 +26,6 @@ describe Gitlab::Auth::LDAP::User do ...@@ -26,7 +26,6 @@ describe Gitlab::Auth::LDAP::User do
let(:auth_hash_upper_case) do let(:auth_hash_upper_case) do
OmniAuth::AuthHash.new(uid: 'uid=John Smith,ou=People,dc=example,dc=com', provider: 'ldapmain', info: info_upper_case) OmniAuth::AuthHash.new(uid: 'uid=John Smith,ou=People,dc=example,dc=com', provider: 'ldapmain', info: info_upper_case)
end end
let!(:fake_proxy) { fake_ldap_sync_proxy('ldapmain') }
describe '#changed?' do describe '#changed?' do
it "marks existing ldap user as changed" do it "marks existing ldap user as changed" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment