X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/647a3a7d3951b1bf7ab7034796e44f1cd2541347..2515c77276ef7a735b1f6c719789f72205d08214:/app/controllers/user_roles_controller.rb diff --git a/app/controllers/user_roles_controller.rb b/app/controllers/user_roles_controller.rb index 536790dc5..5ef68216b 100644 --- a/app/controllers/user_roles_controller.rb +++ b/app/controllers/user_roles_controller.rb @@ -15,7 +15,12 @@ class UserRolesController < ApplicationController end def revoke - UserRole.where(:user_id => @this_user.id, :role => @role).delete_all + # checks that administrator role is not revoked from current user + if current_user == @this_user && @role == "administrator" + flash[:error] = t("user_role.filter.not_revoke_admin_current_user") + else + UserRole.where(:user_id => @this_user.id, :role => @role).delete_all + end redirect_to :controller => "user", :action => "view", :display_name => @this_user.display_name end