forked from nackd/redmine_cas
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,28 @@ | |||
require 'dispatcher' | |||
|
|||
# Patches Redmine's User dinamically. Disallows password change. | |||
module CAS | |||
module UserPatch | |||
def self.included(base) # :nodoc: | |||
base.send(:include, InstanceMethods) | |||
|
|||
base.class_eval do | |||
unloadable # Mark as unloadable so it is reloaded in development | |||
|
|||
alias_method_chain :change_password_allowed?, :cas | |||
end | |||
end | |||
|
|||
module InstanceMethods | |||
def change_password_allowed_with_cas? | |||
CAS::CONFIG['enabled'] ? false : change_password_allowed_without_cas | |||
end | |||
end | |||
end | |||
end | |||
|
|||
Dispatcher.to_prepare do | |||
require_dependency 'principal' | |||
require_dependency 'user' | |||
User.send(:include, CAS::UserPatch) | |||
end |