Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Resolves issue with Ruby 1.9 adding quotes and brackets around login …

…and full name.
  • Loading branch information...
commit 2ca5031b44387cceaa600a67ffaa1298d66c7249 1 parent a44bbe7
@mjblack authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/adauth/user_model.rb
View
10 lib/adauth/user_model.rb
@@ -36,7 +36,7 @@ def ous
# 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
@@ -52,7 +52,7 @@ module ClassMethods
#
# 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
@@ -65,12 +65,12 @@ def return_and_create_with_adauth(adauth_user)
# 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(/\"|\[|\]/, "")
end
end
end
end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.