summaryrefslogtreecommitdiffstats
path: root/app/controllers/users_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2006-12-26 11:28:22 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2006-12-26 11:28:22 +0000
commit4c84165aa074546df9c8d1aea0911b71fd9734bc (patch)
tree877aed86f253ba85075ca4781f6bb7b2841f1ab8 /app/controllers/users_controller.rb
parenta6c8feea214ddd75e9e471140c5be39230c2ee41 (diff)
downloadredmine-4c84165aa074546df9c8d1aea0911b71fd9734bc.tar.gz
redmine-4c84165aa074546df9c8d1aea0911b71fd9734bc.zip
added the ability to manage users memberships directly on users/edit (administration module)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@118 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/users_controller.rb')
-rw-r--r--app/controllers/users_controller.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 47d0e51c9..ab4aae08d 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -80,6 +80,27 @@ class UsersController < ApplicationController
end
end
@auth_sources = AuthSource.find(:all)
+ @roles = Role.find :all
+ @projects = Project.find(:all) - @user.projects
+ @membership ||= Member.new
+ end
+
+ def edit_membership
+ @user = User.find(params[:id])
+ @membership = params[:membership_id] ? Member.find(params[:membership_id]) : Member.new(:user => @user)
+ @membership.attributes = params[:membership]
+ if request.post? and @membership.save
+ flash[:notice] = l(:notice_successful_update)
+ end
+ redirect_to :action => 'edit', :id => @user and return
+ end
+
+ def destroy_membership
+ @user = User.find(params[:id])
+ if request.post? and Member.find(params[:membership_id]).destroy
+ flash[:notice] = l(:notice_successful_update)
+ end
+ redirect_to :action => 'edit', :id => @user and return
end
def destroy