mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Fixed all broken specs
Moved middleware config into authenticators
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
class Plugin::AuthProvider
|
||||
attr_accessor :type, :glyph, :background_color, :name, :title,
|
||||
:message, :frame_width, :frame_height, :options, :callback
|
||||
:message, :frame_width, :frame_height, :authenticator
|
||||
|
||||
end
|
||||
|
||||
@@ -5,7 +5,8 @@ require_dependency 'plugin/auth_provider'
|
||||
|
||||
class Plugin::Instance
|
||||
|
||||
attr_reader :auth_providers, :assets, :path
|
||||
attr_reader :auth_providers, :assets
|
||||
attr_accessor :path, :metadata
|
||||
|
||||
def self.find_all(parent_path)
|
||||
[].tap { |plugins|
|
||||
@@ -17,12 +18,16 @@ class Plugin::Instance
|
||||
}
|
||||
end
|
||||
|
||||
def initialize(metadata, path)
|
||||
def initialize(metadata=nil, path=nil)
|
||||
@metadata = metadata
|
||||
@path = path
|
||||
@assets = []
|
||||
end
|
||||
|
||||
def name
|
||||
metadata.name
|
||||
end
|
||||
|
||||
# will make sure all the assets this plugin needs are registered
|
||||
def generate_automatic_assets!
|
||||
paths = []
|
||||
@@ -152,13 +157,10 @@ class Plugin::Instance
|
||||
@auth_providers ||= []
|
||||
provider = Plugin::AuthProvider.new
|
||||
provider.type = type
|
||||
[:name, :glyph, :background_color, :title, :message, :frame_width, :frame_height, :callback].each do |sym|
|
||||
[:name, :glyph, :background_color, :title, :message, :frame_width, :frame_height, :authenticator].each do |sym|
|
||||
provider.send "#{sym}=", opts.delete(sym)
|
||||
end
|
||||
provider.name ||= type.to_s
|
||||
provider.options = opts[:middleware_options] || opts
|
||||
# prepare for splatting
|
||||
provider.options = [provider.options] if provider.options.is_a? Hash
|
||||
@auth_providers << provider
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user