diff --git a/app/views/redmine_omniauth_saml/_view_account_login_top.html.erb b/app/views/redmine_omniauth_saml/_view_account_login_top.html.erb index 4dff5cd..24c4a2c 100644 --- a/app/views/redmine_omniauth_saml/_view_account_login_top.html.erb +++ b/app/views/redmine_omniauth_saml/_view_account_login_top.html.erb @@ -1,4 +1,4 @@ -<% if Redmine::OmniAuthSAML.enabled? %> +<% if RedmineOmniAuthSaml.enabled? %> <% content_for :header_tags do %> <%= stylesheet_link_tag "login", :plugin => "redmine_omniauth_saml" %> diff --git a/init.rb b/init.rb index bbd6710..9b071b2 100644 --- a/init.rb +++ b/init.rb @@ -1,13 +1,13 @@ require 'redmine' -require 'redmine_omniauth_saml' -require 'redmine_omniauth_saml/hooks' -require 'redmine_omniauth_saml/user_patch' +require File.expand_path('lib/redmine_omni_auth_saml.rb', __dir__) +require File.expand_path('lib/redmine_omni_auth_saml/hooks.rb', __dir__) +require File.expand_path('lib/redmine_omni_auth_saml/user_patch.rb', __dir__) # Patches to existing classes/modules ActiveSupport::Reloader.to_prepare do - require_dependency 'redmine_omniauth_saml/account_helper_patch' - require_dependency 'redmine_omniauth_saml/account_controller_patch' + require_dependency 'redmine_omni_auth_saml/account_helper_patch' + require_dependency 'redmine_omni_auth_saml/account_controller_patch' end # Plugin generic informations diff --git a/lib/redmine_omniauth_saml.rb b/lib/redmine_omni_auth_saml.rb similarity index 99% rename from lib/redmine_omniauth_saml.rb rename to lib/redmine_omni_auth_saml.rb index cc0dc06..9b0bcbd 100644 --- a/lib/redmine_omniauth_saml.rb +++ b/lib/redmine_omni_auth_saml.rb @@ -1,4 +1,5 @@ -module Redmine::OmniAuthSAML + +module RedmineOmniAuthSaml class << self def settings_hash diff --git a/lib/redmine_omniauth_saml/account_controller_patch.rb b/lib/redmine_omni_auth_saml/account_controller_patch.rb similarity index 93% rename from lib/redmine_omniauth_saml/account_controller_patch.rb rename to lib/redmine_omni_auth_saml/account_controller_patch.rb index b57d8d4..6627a81 100644 --- a/lib/redmine_omniauth_saml/account_controller_patch.rb +++ b/lib/redmine_omni_auth_saml/account_controller_patch.rb @@ -1,6 +1,6 @@ require_dependency 'account_controller' -module Redmine::OmniAuthSAML +module RedmineOmniAuthSaml module AccountControllerPatch def self.included(base) base.class_eval do @@ -166,19 +166,19 @@ def saml_logout_user end def name_identifier_value - User.current.send Redmine::OmniAuthSAML.configured_saml[:name_identifier_value].to_sym + User.current.send RedmineOmniAuthSaml.configured_saml[:name_identifier_value].to_sym end def saml_settings - Redmine::OmniAuthSAML.settings_hash + RedmineOmniAuthSaml.settings_hash end def omniauth_saml_settings - Redmine::OmniAuthSAML.configured_saml + RedmineOmniAuthSaml.configured_saml end def saml_logout_url(service = nil) - logout_uri = Redmine::OmniAuthSAML.configured_saml[:signout_url] + logout_uri = RedmineOmniAuthSaml.configured_saml[:signout_url] logout_uri += service.to_s unless logout_uri.blank? logout_uri || home_url end @@ -186,7 +186,7 @@ def saml_logout_url(service = nil) end end -unless AccountController.included_modules.include? Redmine::OmniAuthSAML::AccountControllerPatch - AccountController.prepend(Redmine::OmniAuthSAML::AccountControllerPatch) +unless AccountController.included_modules.include? RedmineOmniAuthSaml::AccountControllerPatch + AccountController.prepend(RedmineOmniAuthSaml::AccountControllerPatch) AccountController.before_action :verify_authenticity_token, :except => [:login_with_saml_callback] end diff --git a/lib/redmine_omniauth_saml/account_helper_patch.rb b/lib/redmine_omni_auth_saml/account_helper_patch.rb similarity index 50% rename from lib/redmine_omniauth_saml/account_helper_patch.rb rename to lib/redmine_omni_auth_saml/account_helper_patch.rb index 83848da..b478fe8 100644 --- a/lib/redmine_omniauth_saml/account_helper_patch.rb +++ b/lib/redmine_omni_auth_saml/account_helper_patch.rb @@ -1,6 +1,6 @@ require_dependency 'account_helper' -module Redmine::OmniAuthSAML +module RedmineOmniAuthSaml module AccountHelperPatch def self.included(base) base.send(:include, InstanceMethods) @@ -11,12 +11,12 @@ def self.included(base) module InstanceMethods def label_for_saml_login - Redmine::OmniAuthSAML.label_login_with_saml.presence || l(:label_login_with_saml) + RedmineOmniAuthSaml.label_login_with_saml.presence || l(:label_login_with_saml) end end end end -unless AccountHelper.included_modules.include? Redmine::OmniAuthSAML::AccountHelperPatch - AccountHelper.send(:include, Redmine::OmniAuthSAML::AccountHelperPatch) +unless AccountHelper.included_modules.include? RedmineOmniAuthSaml::AccountHelperPatch + AccountHelper.send(:include, RedmineOmniAuthSaml::AccountHelperPatch) end diff --git a/lib/redmine_omniauth_saml/hooks.rb b/lib/redmine_omni_auth_saml/hooks.rb similarity index 83% rename from lib/redmine_omniauth_saml/hooks.rb rename to lib/redmine_omni_auth_saml/hooks.rb index 02316d5..3c0ff98 100644 --- a/lib/redmine_omniauth_saml/hooks.rb +++ b/lib/redmine_omni_auth_saml/hooks.rb @@ -1,4 +1,4 @@ -module Redmine::OmniAuthSAML +module RedmineOmniAuthSaml class Hooks < Redmine::Hook::ViewListener render_on :view_account_login_top, :partial => 'redmine_omniauth_saml/view_account_login_top' end diff --git a/lib/redmine_omniauth_saml/user_patch.rb b/lib/redmine_omni_auth_saml/user_patch.rb similarity index 92% rename from lib/redmine_omniauth_saml/user_patch.rb rename to lib/redmine_omni_auth_saml/user_patch.rb index 53bf86d..5f80883 100644 --- a/lib/redmine_omniauth_saml/user_patch.rb +++ b/lib/redmine_omni_auth_saml/user_patch.rb @@ -1,6 +1,6 @@ require_dependency 'user' -module OmniAuthSamlUser +module RedmineOmniAuthSaml::UserPatch def self.prepended(base) class << base self.prepend(OmniAuthSamlUserMethods) @@ -35,4 +35,4 @@ def change_password_allowed? end -User.prepend(OmniAuthSamlUser) +User.prepend(RedmineOmniAuthSaml::UserPatch)