Commit 4eef112462e4a9d7d990603896810d0e945e1769

Authored by Dmitriy Zaporozhets
2 parents c403c2a8 19e8473e

Merge pull request #1906 from dosire/user_cannot_be_removed_if_project_owner

Cannot remove user that owns a project.
Showing 1 changed file with 3 additions and 0 deletions   Show diff stats
app/controllers/admin/users_controller.rb
... ... @@ -98,6 +98,9 @@ class Admin::UsersController < AdminController
98 98  
99 99 def destroy
100 100 @admin_user = User.find(params[:id])
  101 + if @admin_user.my_own_projects.count > 0
  102 + redirect_to admin_users_path, alert: "User is a project owner and can't be removed." and return
  103 + end
101 104 @admin_user.destroy
102 105  
103 106 respond_to do |format|
... ...