Commit 5f361e71 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

only active users are now proposed when adding a member to a project

git-svn-id: http://redmine.rubyforge.org/svn/trunk@190 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 13881f5a
......@@ -92,7 +92,7 @@ class ProjectsController < ApplicationController
@issue_category ||= IssueCategory.new
@member ||= @project.members.new
@roles = Role.find(:all)
@users = User.find(:all) - @project.members.find(:all, :include => :user).collect{|m| m.user }
@users = User.find_active(:all) - @project.users
@custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) }
end
......
......@@ -49,7 +49,19 @@ class User < ActiveRecord::Base
# update hashed_password if password was set
self.hashed_password = User.hash_password(self.password) if self.password
end
def self.active
with_scope :find => { :conditions => [ "status = ?", STATUS_ACTIVE ] } do
yield
end
end
def self.find_active(*args)
active do
find(*args)
end
end
# Returns the user that matches provided login and password, or nil
def self.try_to_login(login, password)
user = find(:first, :conditions => ["login=?", login])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment