Skip to content

Commit

Permalink
Disable self registration link
Browse files Browse the repository at this point in the history
  • Loading branch information
nackd committed Dec 29, 2010
1 parent 477f29f commit 3cdf9ec
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions init.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
require 'redmine' require 'redmine'
require 'cas/account_controller_patch' require 'cas/account_controller_patch'
require 'cas/application_controller_patch' require 'cas/application_controller_patch'
require 'cas/setting_patch'
require 'cas/user_patch' require 'cas/user_patch'


Redmine::Plugin.register :redmine_cas do Redmine::Plugin.register :redmine_cas do
Expand Down
29 changes: 29 additions & 0 deletions lib/cas/setting_patch.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,29 @@
require 'dispatcher'

# Patches Redmine's Setting dinamically. Disables self registration link.
module CAS
module SettingPatch
def self.included(base) # :nodoc:
base.extend(ClassMethods)

base.class_eval do
unloadable # Mark as unloadable so it is reloaded in development

class << self
alias_method_chain :self_registration?, :cas
end
end
end

module ClassMethods
def self_registration_with_cas?
CAS::CONFIG['enabled'] ? false : self_registration_without_cas?
end
end
end
end

Dispatcher.to_prepare do
require_dependency 'setting'
Setting.send(:include, CAS::SettingPatch)
end

0 comments on commit 3cdf9ec

Please sign in to comment.