Skip to content

UPD depricated finders #197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/casserver/authenticators/sql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,6 @@ def log_connection_pool_size
end

def matching_users
user_model.find(:all, :conditions => ["#{username_column} = ? AND #{password_column} = ?", @username, @password])
user_model.where("#{username_column} = ? AND #{password_column} = ?", @username, @password)
end
end
2 changes: 1 addition & 1 deletion lib/casserver/authenticators/sql_authlogic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ def validate(credentials)
protected

def matching_users
user_model.find(:all, :conditions => ["#{username_column} = ?", @username])
user_model.where("#{username_column} = ?", @username)
end
end
4 changes: 2 additions & 2 deletions lib/casserver/authenticators/sql_bcrypt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class CASServer::Authenticators::SQLBcrypt < CASServer::Authenticators::SQL
protected

def matching_users
results = user_model.find(:all, :conditions => ["#{username_column} = ?", @username])
results = user_model.where("#{username_column} = ?", @username)
results.select { |user| BCrypt::Password.new(user.send(password_column.to_sym)) == @password }
end

end
end
2 changes: 1 addition & 1 deletion lib/casserver/authenticators/sql_encrypted.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def validate(credentials)
encrypt_function = @options[:encrypt_function] || 'user.encrypted_password == Digest::SHA256.hexdigest("#{user.encryption_salt}::#{@password}")'

log_connection_pool_size
results = user_model.find(:all, :conditions => ["#{username_column} = ?", @username])
results = user_model.where("#{username_column} = ?", @username)
user_model.connection_pool.checkin(user_model.connection)

if results.size > 0
Expand Down
2 changes: 1 addition & 1 deletion lib/casserver/authenticators/sql_rest_auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def validate(credentials)
username_column = @options[:username_column] || "email"

log_connection_pool_size
results = user_model.find(:all, :conditions => ["#{username_column} = ?", @username])
results = user_model.where("#{username_column} = ?", @username)
user_model.connection_pool.checkin(user_model.connection)

if results.size > 0
Expand Down
6 changes: 2 additions & 4 deletions lib/casserver/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,7 @@ def self.init_database!
st.destroy
end

pgts = CASServer::Model::ProxyGrantingTicket.find(:all,
:conditions => [CASServer::Model::ServiceTicket.quoted_table_name+".username = ?", tgt.username],
:include => :service_ticket)
pgts = CASServer::Model::ProxyGrantingTicket.includes(:service_ticket).where(CASServer::Model::ServiceTicket.quoted_table_name+".username = ?", tgt.username)
pgts.each do |pgt|
$LOG.debug("Deleting Proxy-Granting Ticket '#{pgt}' for user '#{pgt.service_ticket.username}'")
pgt.destroy
Expand Down Expand Up @@ -785,4 +783,4 @@ def authenticated_username
end
end
end
end
end