Commit 34c8ca28 authored by Jeroen van Baarsen's avatar Jeroen van Baarsen

Fix for edit user as admin

* It fixes an issue where you where able to remove your own
  admin rights. This would result in a 404 error. fixes: #2283
* It fixes an issue where you would be able to block your own
  account on the edit page. This fix makes the behaviour the same
  as on the admin/users overview page
parent 12dbd0a4
...@@ -56,8 +56,12 @@ ...@@ -56,8 +56,12 @@
.form-group .form-group
= f.label :admin, class: 'control-label' = f.label :admin, class: 'control-label'
.col-sm-10= f.check_box :admin - if current_user == @user
- unless @user.new_record? .col-sm-10= f.check_box :admin, disabled: true
.col-sm-10 You cannot remove your own admin rights
- else
.col-sm-10= f.check_box :admin
- unless @user.new_record? || current_user == @user
.alert.alert-danger .alert.alert-danger
- if @user.blocked? - if @user.blocked?
%p This user is blocked and is not able to login to GitLab %p This user is blocked and is not able to login to GitLab
......
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