用户修改密码、删除项目成员 添加事务处理
This commit is contained in:
parent
7faddc30c5
commit
d304555044
|
@ -392,6 +392,8 @@ class MembersController < ApplicationController
|
||||||
#课程成员删除修改
|
#课程成员删除修改
|
||||||
if @project
|
if @project
|
||||||
if request.delete? && @member.deletable?
|
if request.delete? && @member.deletable?
|
||||||
|
ActiveRecord::Base.transaction do
|
||||||
|
begin
|
||||||
@member.destroy
|
@member.destroy
|
||||||
# end
|
# end
|
||||||
user_admin = ProjectInfo.where("user_id = ? and project_id = ?", @member.user_id, @project.id)
|
user_admin = ProjectInfo.where("user_id = ? and project_id = ?", @member.user_id, @project.id)
|
||||||
|
@ -413,6 +415,10 @@ class MembersController < ApplicationController
|
||||||
end
|
end
|
||||||
#移出项目发送消息
|
#移出项目发送消息
|
||||||
ForgeMessage.create(:user_id => @member.user_id, :project_id => @project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => User.current.id)
|
ForgeMessage.create(:user_id => @member.user_id, :project_id => @project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => User.current.id)
|
||||||
|
rescue Exception => e
|
||||||
|
puts e
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to_settings_in_projects }
|
format.html { redirect_to_settings_in_projects }
|
||||||
|
|
|
@ -159,8 +159,8 @@ class MyController < ApplicationController
|
||||||
g = Gitlab.client
|
g = Gitlab.client
|
||||||
begin
|
begin
|
||||||
g.edit_user(@user.gid, :email => params[:user][:mail])
|
g.edit_user(@user.gid, :email => params[:user][:mail])
|
||||||
rescue
|
rescue Exception => e
|
||||||
logger.error "sync user's email of gitlab failed!"
|
puts e
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -232,6 +232,7 @@ class UsersService
|
||||||
|
|
||||||
#修改密码
|
#修改密码
|
||||||
def change_password params
|
def change_password params
|
||||||
|
ActiveRecord::Base.transaction do
|
||||||
@current_user = User.find(params[:current_user_id])
|
@current_user = User.find(params[:current_user_id])
|
||||||
if @current_user.check_password?(params[:password])
|
if @current_user.check_password?(params[:password])
|
||||||
@current_user.password, @current_user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
@current_user.password, @current_user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
||||||
|
@ -252,6 +253,7 @@ class UsersService
|
||||||
end
|
end
|
||||||
@current_user
|
@current_user
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
#搜索用户
|
#搜索用户
|
||||||
def search_user params
|
def search_user params
|
||||||
|
|
Loading…
Reference in New Issue