@ -22,6 +22,8 @@ class Principal < ActiveRecord::Base
# Groups and active users
named_scope:active,:conditions=>"#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status = 1)"
named_scope:active_or_registered,:conditions=>"#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND (#{Principal.table_name}.status = #{User::STATUS_ACTIVE} OR #{Principal.table_name}.status = #{User::STATUS_REGISTERED}))"
named_scope:like,lambda{|q|
s="%#{q.to_s.strip.downcase}%"
{:conditions=>["LOWER(login) LIKE :s OR LOWER(firstname) LIKE :s OR LOWER(lastname) LIKE :s OR LOWER(mail) LIKE :s",{:s=>s}],
@ -36,7 +38,7 @@ class Principal < ActiveRecord::Base