lib/adauth/user_model.rb in adauth-1.2.0 vs lib/adauth/user_model.rb in adauth-1.2.1

- old
+ new

@@ -34,11 +34,11 @@ # UserInstance.update_from_adauth(AdauthUserInstance) # # This method is called on login and shouldn't need to be called at any other time def update_from_adauth(adauth_user) self.group_strings = adauth_user.groups.join(", ") - self.name = adauth_user.name + self.name = adauth_user.name.gsub(/\"|\[|\]/, "") self.save end # Class methods for the UserModel module ClassMethods @@ -50,11 +50,11 @@ # Called as # YourUserModel.return_and_create_with_adauth(AdauthUserInstance) # # If the user has no user record in the database one will be created. All the details on the record (new and old) will be updated to the lastest details from the AD server def return_and_create_with_adauth(adauth_user) - user = (find_by_login(adauth_user.login) || create_user_with_adauth(adauth_user)) + user = (find_by_login(adauth_user.login.gsub(/\"|\[|\]/, "")) || create_user_with_adauth(adauth_user)) user.update_from_adauth(adauth_user) return user end # Creates a user record from an instance of Adauth::User @@ -63,14 +63,14 @@ # YourUserModel.create_user_with_adauth(AdauthUserInstance) # # Takes the Adauth::User input and creates a user record with matching details def create_user_with_adauth(adauth_user) create! do |user| - user.login = adauth_user.login + user.login = adauth_user.login.gsub(/\"|\[|\]/, "") user.group_strings = adauth_user.groups.join(", ") user.ou_strings = adauth_user.ous.join(", ") - user.name = adauth_user.name + user.name = adauth_user.name.gsub(/\"|\[|\]/, "") end end end end -end \ No newline at end of file +end