-
Notifications
You must be signed in to change notification settings - Fork 29
Migrating from 1.x to 2.x
The process for migrating from 1.x to 2.x requires a few changes to be made to your application.
Your config will need changing!
The admin_user and admin_password values need changing to query_user and query_password, and they must be defined. Adauth can no longer be run without a user to run queries as.
A couple of the methods used by the sessions controller code have been changed. Running:
rails g sessions
will trigger file conflicts and let you use the generators confilt resolution to see the diffs and fix any issues, if you are just using the generated code you can just over write the files with the new ones.
Your User model will need a few changes making to it, for the purposes of simplicity I'm going to assume that your user model is the generated one and looks like this:
class User < ActiveRecord::Base
include Adauth::UserModel
end
The first change is that Adauth::UserModel
needs changing to Adauth::Rails::ModelBridge
.
You now need to define 2 constants AdauthMappings
and AdauthSearchField
AdauthMappings = {
:login => :login,
:group_strings => :cn_groups,
:ou_strings => :dn_ous,
:name => :name
}
AdauthSearchField = [:login, :login]
This tells Adauth::Rails::ModelBridge
how to translate the values from adauth to your model.
You also need to define the groups method
def groups
group_strings.split(", ")
end
Your Adauth install will now work no problems on version 2.