Fixing port conflicts

parent 08b45fc9
......@@ -6,13 +6,10 @@ module AuthHelper
def ldap_enabled?
Gitlab::Auth::LDAP::Config.enabled?
<<<<<<< HEAD
end
def kerberos_enabled?
auth_providers.include?(:kerberos)
=======
>>>>>>> upstream/master
end
def omniauth_enabled?
......
......@@ -6,11 +6,7 @@ module Gitlab
module Auth
module LDAP
class Access
<<<<<<< HEAD
attr_reader :provider, :user, :ldap_identity
=======
attr_reader :provider, :user
>>>>>>> upstream/master
def self.open(user, &block)
Gitlab::Auth::LDAP::Adapter.open(user.ldap_identity.provider) do |adapter|
......@@ -18,18 +14,12 @@ module Gitlab
end
end
<<<<<<< HEAD
def self.allowed?(user, options = {})
self.open(user) do |access|
# Whether user is allowed, or not, we should update
# permissions to keep things clean
if access.allowed?
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
true
......@@ -42,12 +32,8 @@ module Gitlab
def initialize(user, adapter = nil)
@adapter = adapter
@user = user
<<<<<<< HEAD
@ldap_identity = user.ldap_identity
@provider = adapter&.provider || @ldap_identity&.provider
=======
@provider = user.ldap_identity.provider
>>>>>>> upstream/master
end
def allowed?
......@@ -58,11 +44,7 @@ module Gitlab
end
# 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?(user.ldap_identity.extern_uid, adapter)
>>>>>>> upstream/master
block_user(user, 'is disabled in Active Directory')
false
else
......@@ -84,7 +66,6 @@ module Gitlab
Gitlab::Auth::LDAP::Config.new(provider)
end
<<<<<<< HEAD
def find_ldap_user
return unless provider
......@@ -98,16 +79,11 @@ module Gitlab
def 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
def block_user(user, reason)
user.ldap_block
<<<<<<< HEAD
if provider
Gitlab::AppLogger.info(
"LDAP account \"#{ldap_identity.extern_uid}\" #{reason}, " \
......@@ -119,19 +95,12 @@ module Gitlab
"blocking Gitlab user \"#{user.name}\" (#{user.email})"
)
end
=======
Gitlab::AppLogger.info(
"LDAP account \"#{user.ldap_identity.extern_uid}\" #{reason}, " \
"blocking Gitlab user \"#{user.name}\" (#{user.email})"
)
>>>>>>> upstream/master
end
def unblock_user(user, reason)
user.activate
Gitlab::AppLogger.info(
<<<<<<< HEAD
"LDAP account \"#{ldap_identity.extern_uid}\" #{reason}, " \
"unblocking Gitlab user \"#{user.name}\" (#{user.email})"
)
......@@ -241,12 +210,6 @@ module Gitlab
def logger
Rails.logger
end
=======
"LDAP account \"#{user.ldap_identity.extern_uid}\" #{reason}, " \
"unblocking Gitlab user \"#{user.name}\" (#{user.email})"
)
end
>>>>>>> upstream/master
end
end
end
......
......@@ -2,11 +2,8 @@ module Gitlab
module Auth
module LDAP
class Adapter
<<<<<<< HEAD
prepend ::EE::Gitlab::Auth::LDAP::Adapter
=======
>>>>>>> upstream/master
attr_reader :provider, :ldap
def self.open(provider, &block)
......
......@@ -3,11 +3,8 @@ module Gitlab
module Auth
module LDAP
class Config
<<<<<<< HEAD
include ::EE::Gitlab::Auth::LDAP::Config
=======
>>>>>>> upstream/master
NET_LDAP_ENCRYPTION_METHOD = {
simple_tls: :simple_tls,
start_tls: :start_tls,
......@@ -16,11 +13,8 @@ module Gitlab
attr_accessor :provider, :options
<<<<<<< HEAD
InvalidProvider = Class.new(StandardError)
=======
>>>>>>> upstream/master
def self.enabled?
Gitlab.config.ldap.enabled
end
......@@ -32,11 +26,7 @@ module Gitlab
def self.available_servers
return [] unless enabled?
<<<<<<< HEAD
::License.feature_available?(:multiple_ldap_servers) ? servers : Array.wrap(servers.first)
=======
Array.wrap(servers.first)
>>>>>>> upstream/master
end
def self.providers
......@@ -48,11 +38,7 @@ module Gitlab
end
def self.invalid_provider(provider)
<<<<<<< HEAD
raise InvalidProvider.new("Unknown provider (#{provider}). Available providers: #{providers}")
=======
raise "Unknown provider (#{provider}). Available providers: #{providers}"
>>>>>>> upstream/master
end
def initialize(provider)
......@@ -102,24 +88,17 @@ module Gitlab
end
def base
<<<<<<< HEAD
@base ||= Person.normalize_dn(options['base'])
=======
options['base']
>>>>>>> upstream/master
end
def uid
options['uid']
end
<<<<<<< HEAD
def label
options['label']
end
=======
>>>>>>> upstream/master
def sync_ssh_keys?
sync_ssh_keys.present?
end
......@@ -161,13 +140,10 @@ module Gitlab
options['timeout'].to_i
end
<<<<<<< HEAD
def external_groups
options['external_groups']
end
=======
>>>>>>> upstream/master
def has_auth?
options['password'] || options['bind_dn']
end
......
<<<<<<< HEAD
# Contains methods common to both GitLab CE and EE.
# All EE methods should be in `EE::Gitlab::Auth::LDAP::Person` only.
=======
>>>>>>> upstream/master
module Gitlab
module Auth
module LDAP
class Person
<<<<<<< HEAD
prepend ::EE::Gitlab::Auth::LDAP::Person
=======
>>>>>>> upstream/master
# Active Directory-specific LDAP filter that checks if bit 2 of the
# userAccountControl attribute is set.
# Source: http://ctogonewild.com/2009/09/03/bitmask-searches-in-ldap/
......
......@@ -8,11 +8,8 @@ module Gitlab
module Auth
module LDAP
class User < Gitlab::Auth::OAuth::User
<<<<<<< HEAD
prepend ::EE::Gitlab::Auth::LDAP::User
=======
>>>>>>> upstream/master
class << self
def find_by_uid_and_provider(uid, provider)
identity = ::Identity.with_extern_uid(provider, uid).take
......
......@@ -4,11 +4,8 @@ module Gitlab
module Auth
module OAuth
class AuthHash
<<<<<<< HEAD
prepend ::EE::Gitlab::Auth::OAuth::AuthHash
=======
>>>>>>> upstream/master
attr_reader :auth_hash
def initialize(auth_hash)
@auth_hash = auth_hash
......
......@@ -7,11 +7,8 @@ module Gitlab
module Auth
module OAuth
class User
<<<<<<< HEAD
prepend ::EE::Gitlab::Auth::OAuth::User
=======
>>>>>>> upstream/master
SignupDisabledError = Class.new(StandardError)
SigninDisabledForProviderError = Class.new(StandardError)
......
......@@ -14,7 +14,6 @@ module Gitlab
def external_groups
options[:external_groups]
end
<<<<<<< HEAD
def required_groups
Array(options[:required_groups])
......@@ -23,8 +22,6 @@ module Gitlab
def admin_groups
options[:admin_groups]
end
=======
>>>>>>> upstream/master
end
end
end
......
......@@ -18,7 +18,6 @@ module Gitlab
user ||= find_or_build_ldap_user if auto_link_ldap_user?
user ||= build_new_user if signup_enabled?
<<<<<<< HEAD
if user_in_required_group?
unblock_user(user, "in required group") if user.persisted? && user.blocked?
elsif user.persisted?
......@@ -30,12 +29,6 @@ module Gitlab
if user
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?
=======
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
user
......@@ -49,7 +42,6 @@ module Gitlab
protected
<<<<<<< HEAD
def block_user(user, reason)
user.ldap_block
log_user_changes(user, "#{reason}, blocking")
......@@ -72,8 +64,6 @@ module Gitlab
required_groups.empty? || !(auth_hash.groups & required_groups).empty?
end
=======
>>>>>>> upstream/master
def auto_link_saml_user?
Gitlab.config.omniauth.auto_link_saml_user
end
......@@ -85,13 +75,10 @@ module Gitlab
def auth_hash=(auth_hash)
@auth_hash = Gitlab::Auth::Saml::AuthHash.new(auth_hash)
end
<<<<<<< HEAD
def admin_groups_enabled?
!Gitlab::Auth::Saml::Config.admin_groups.nil?
end
=======
>>>>>>> upstream/master
end
end
end
......
This diff is collapsed.
......@@ -26,7 +26,6 @@ describe Gitlab::Auth::LDAP::User 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)
end
let!(:fake_proxy) { fake_ldap_sync_proxy('ldapmain') }
describe '#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