Commit 4eef1124 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #1906 from dosire/user_cannot_be_removed_if_project_owner

Cannot remove user that owns a project.
parents c403c2a8 19e8473e
...@@ -98,6 +98,9 @@ class Admin::UsersController < AdminController ...@@ -98,6 +98,9 @@ class Admin::UsersController < AdminController
def destroy def destroy
@admin_user = User.find(params[:id]) @admin_user = User.find(params[:id])
if @admin_user.my_own_projects.count > 0
redirect_to admin_users_path, alert: "User is a project owner and can't be removed." and return
end
@admin_user.destroy @admin_user.destroy
respond_to do |format| respond_to do |format|
......
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