Skip to content

Commit

Permalink
[webui] fix some more require login checks
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Dec 2, 2014
1 parent 1859e7e commit 1b920db
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/api/app/controllers/webui/driver_update_controller.rb
Expand Up @@ -4,6 +4,7 @@ class Webui::DriverUpdateController < Webui::PackageController
before_filter :require_package
before_filter :require_available_architectures, :only => [:create, :edit]
before_filter :check_images_repo, :only => [:create, :edit]
before_filter :require_login

def create
services = Service.find :project => @project, :package => @package
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/controllers/webui/group_controller.rb
Expand Up @@ -3,7 +3,7 @@ class Webui::GroupController < Webui::WebuiController
include Webui::WebuiHelper

before_filter :overwrite_group, only: [:edit]
before_filter :require_login, only: [:save]
before_filter :require_login, except: [:show, :tokens, :autocomplete]

def autocomplete
required_parameters :term
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/controllers/webui/package_controller.rb
Expand Up @@ -18,7 +18,7 @@ class Webui::PackageController < Webui::WebuiController
before_filter :require_project, :except => [:submit_request, :devel_project]
before_filter :require_package, :except => [:submit_request, :save_new_link, :save_new, :devel_project ]
# make sure it's after the require_, it requires both
before_filter :require_login, :only => [:branch]
before_filter :require_login, :only => [:branch, :submit_request, :save, :save_new, :save_new_link]
prepend_before_filter :lockout_spiders, :only => [:revisions, :dependency, :rdiff, :binary, :binaries, :requests]

def show
Expand Down
4 changes: 4 additions & 0 deletions src/api/test/fixtures/groups.yml
Expand Up @@ -11,5 +11,9 @@ test_group_b:
created_at: 2011-07-29 14:00:21.000000000 Z
updated_at: 2011-07-29 14:00:21.000000000 Z
title: test_group_b
test_group_empty:
created_at: 2011-07-29 14:00:21.000000000 Z
updated_at: 2011-07-29 14:00:21.000000000 Z
title: test_group_empty
honks:
title: honks
12 changes: 6 additions & 6 deletions src/api/test/functional/webui/group_controller_test.rb
Expand Up @@ -9,13 +9,13 @@ class Webui::GroupControllerTest < Webui::IntegrationTest

login_king to: configuration_groups_path

find(:id, 'group_table_wrapper').must_have_text 'Showing 1 to 4 of 4 entries'
find(:id, 'test_group_b').click
find(:id, 'group_table_wrapper').must_have_text 'Showing 1 to 5 of 5 entries'
find(:id, 'test_group_empty').click
find(:id, 'content').must_have_text 'This group does not contain users'

visit configuration_groups_path
find(:id, 'test_group').click
find(:id, 'group_members_table_wrapper').must_have_text 'Showing 1 to 1 of 1 entries'
find(:id, 'group_members_table_wrapper').must_have_text 'Showing 1 to 2 of 2 entries'
find(:link, 'adrian').click
assert page.current_url.end_with? user_show_path(user: 'adrian')
end
Expand All @@ -25,7 +25,7 @@ class Webui::GroupControllerTest < Webui::IntegrationTest

login_king to: configuration_groups_path
within '#group-test_group' do
find('td.users').text.must_equal 'adrian'
find('td.users').text.must_equal 'adrian_downloader, adrian'
click_link 'Edit Group'
end
page.must_have_text 'Edit Group test_group'
Expand Down Expand Up @@ -56,7 +56,7 @@ class Webui::GroupControllerTest < Webui::IntegrationTest
visit group_tokens_path(q: 'test')
page.status_code.must_equal 200

JSON.parse(page.source).must_equal [{'name' => 'test_group'}, {'name' => 'test_group_b'}]
JSON.parse(page.source).must_equal [{'name' => 'test_group'}, {'name' => 'test_group_b'}, {'name' => 'test_group_empty'}]
end

test 'autocomplete group' do
Expand All @@ -71,7 +71,7 @@ class Webui::GroupControllerTest < Webui::IntegrationTest
visit group_autocomplete_path(term: 'test')
page.status_code.must_equal 200

JSON.parse(page.source).must_equal %w(test_group test_group_b)
JSON.parse(page.source).must_equal %w(test_group test_group_b test_group_empty)
end

end
2 changes: 1 addition & 1 deletion src/api/test/functional/webui/owner_search_test.rb
Expand Up @@ -69,7 +69,7 @@ def search_results
assert result[:owners].include? "(Iggy) as maintainer"
assert result[:owners].include? "(Iggy) as bugowner"
# test_group_b is maintainer, but has no active member
assert_not result[:owners].include? "test_group_b as maintainer"
assert_not result[:owners].include? "test_group_empty as maintainer"
end

test "owner_search_with_devel" do
Expand Down

0 comments on commit 1b920db

Please sign in to comment.