Skip to content

Commit

Permalink
[webui] Fix make admin link
Browse files Browse the repository at this point in the history
The `make admin` link did not work anymore. This fixes #3705
  • Loading branch information
Manuel Schnitzer committed Aug 30, 2017
1 parent 1bdc61b commit aad8af2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/api/app/controllers/webui/user_controller.rb
Expand Up @@ -122,7 +122,7 @@ def lock
end

def admin
@displayed_user.update_globalroles(%w(Admin))
@displayed_user.update_globalroles(Role.where(title: 'Admin'))
@displayed_user.save
redirect_back(fallback_location: { action: 'show', user: @displayed_user })
end
Expand Down
11 changes: 9 additions & 2 deletions src/api/spec/controllers/webui/user_controller_spec.rb
Expand Up @@ -271,8 +271,15 @@
skip
end

describe "GET #admin" do
skip
describe "POST #admin" do
before do
login admin_user
post :admin, params: { user: user.login }
end

it 'applies the Admin role properly' do
expect(user.roles.find_by(title: 'Admin')).to_not be_nil
end
end

describe "GET #save_dialog" do
Expand Down

0 comments on commit aad8af2

Please sign in to comment.