perm read
Added by Zdravko Balorda about 11 years ago
Hi,
every other module has permission "read" (view), except news and forums. I have users that I need to deny access to these two, but I can't. Any hint how to fix this?
Replies (4)
RE: perm read - Added by Mischa The Evil about 11 years ago
RE: perm read - Added by Mischa The Evil about 11 years ago
FTR: you could patch the source yourself and set the public option of both :view_*
permissions to false explicitly (see source:/trunk/lib/redmine.rb#L89). However, this is not supported and/or tested, may result in uncovered edge-cases and may introduce other side-effects which aren't handled in the core at the moment.
RE: perm read - Added by Zdravko Balorda about 11 years ago
Thanks. I found it. Both permissions already exist and are overridden by public = true.
RE: perm read - Added by Mischa The Evil about 11 years ago
Please confirm yourself of the fact that you know for sure that you know what you are doing while applying these two changes, and be sure to handle all the issues they raise. If you manage to do that properly, then feel free to share your patches (prefereably including test coverage) with the community.
To show what I meant in RE: perm read I ran the testsuite with these two changes applied (on a recent, otherwise vanilla trunk without any plugins). And...? Well, see the log for yourself. 27 failures and one clear error while the whole suite completes succesfully when ran without these two changes applied :-/
View complete test log...View complete test log...
root@ubuntu:/var/www/redmine-trunk.local.lan# rake test | tee -a tests_with_view_news_and_forums_public_permissions_set_to_false.txt Version: ImageMagick 6.6.9-7 2012-08-17 Q16 http://www.imagemagick.org Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC Features: OpenMP (Test LDAP server not configured) * DEFERRED: #render_project should be tested. * DEFERRED: #render_issues should be tested. * DEFERRED: #render_version should be tested. * DEFERRED: #subject_for_project should test the PNG format. * DEFERRED: #subject_for_project should test the PDF format. * DEFERRED: #line_for_project :html format late line should start from the starting point on the left. * DEFERRED: #line_for_project :html format late line should be the total delayed width of the project. * DEFERRED: #line_for_project :html format done line should start from the starting point on the left. * DEFERRED: #line_for_project :html format done line should Be the total done width of the project. * DEFERRED: #line_for_project :html format status content should show the percent complete. * DEFERRED: #line_for_project should test the PNG format. * DEFERRED: #line_for_project should test the PDF format. * DEFERRED: #subject_for_version should test the PNG format. * DEFERRED: #subject_for_version should test the PDF format. * DEFERRED: #line_for_version should test the PNG format. * DEFERRED: #line_for_version should test the PDF format. * DEFERRED: #subject_for_issue should test the PNG format. * DEFERRED: #subject_for_issue should test the PDF format. * DEFERRED: #line_for_issue should test the PNG format. * DEFERRED: #line_for_issue should test the PDF format. * DEFERRED: #to_image should be tested. * DEFERRED: #to_pdf should be tested. * DEFERRED: MenuManager#current_menu_item should be tested. * DEFERRED: MenuManager#render_main_menu should be tested. * DEFERRED: MenuManager#render_menu should be tested. * DEFERRED: MenuManager#menu_item_and_children should be tested. * DEFERRED: MenuManager#extract_node_details should be tested. * DEFERRED: MenuItem#caption should be tested. * DEFERRED: MenuItem#html_options should be tested. Bazaar test repository NOT FOUND. Skipping unit tests !!! Cvs test repository NOT FOUND. Skipping unit tests !!! Darcs test repository NOT FOUND. Skipping unit tests !!! Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS. Git test repository NOT FOUND. Skipping unit tests !!! Mercurial test repository NOT FOUND. Skipping unit tests !!! Subversion test repository NOT FOUND. Skipping unit tests !!! Bazaar test repository NOT FOUND. Skipping unit tests !!! CVS test repository NOT FOUND. Skipping unit tests !!! Darcs test repository NOT FOUND. Skipping unit tests !!! Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS. Git test repository NOT FOUND. Skipping unit tests !!! Mercurial test repository NOT FOUND. Skipping unit tests !!! Subversion test repository NOT FOUND. Skipping unit tests !!! Skipping LDAP tests. Run options: # Running tests: .............F.......................................................F................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................FF..FF..F.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F.............................................................. Finished tests in 599.439272s, 2.8010 tests/s, 20.4758 assertions/s. 1) Failure: test_global_activity_anonymous(ActivityTest) [/var/www/redmine-trunk.local.lan/test/unit/activity_test.rb:53]: Failed assertion, no message given. 2) Failure: test_redmine_links(ApplicationHelperTest) [/var/www/redmine-trunk.local.lan/test/unit/helpers/application_helper_test.rb:373]: forum#2 failed. <"<p><a href=\"/projects/ecookbook/boards/2\" class=\"board\">Discussion</a></p>"> expected but was <"<p>forum#2</p>">. 3) Failure: test_attachments_should_be_deletable_with_manage_news_permission(NewsTest) [/var/www/redmine-trunk.local.lan/test/unit/news_test.rb:82]: Failed assertion, no message given. 4) Failure: test_attachments_should_be_visible(NewsTest) [/var/www/redmine-trunk.local.lan/test/unit/news_test.rb:77]: Failed assertion, no message given. 5) Failure: test_should_include_news_for_projects_with_news_enabled(NewsTest) [/var/www/redmine-trunk.local.lan/test/unit/news_test.rb:45]: Failed assertion, no message given. 6) Failure: test_should_limit_the_amount_of_returned_news(NewsTest) [/var/www/redmine-trunk.local.lan/test/unit/news_test.rb:66]: <2> expected but was <0>. 7) Failure: test_should_return_5_news_stories_by_default(NewsTest) [/var/www/redmine-trunk.local.lan/test/unit/news_test.rb:73]: <5> expected but was <0>. 8) Failure: test_prune(WatcherTest) [/var/www/redmine-trunk.local.lan/test/unit/watcher_test.rb:161]: "Watcher.count" didn't change by 0. <12> expected but was <10>. 1679 tests, 12274 assertions, 8 failures, 0 errors, 0 skips ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux] Version: ImageMagick 6.6.9-7 2012-08-17 Q16 http://www.imagemagick.org Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC Features: OpenMP test/unit warning: method IssuesControllerTest#test_index_with_query_grouped_by_tracker is redefined test/unit warning: method UsersControllerTest#test_index is redefined Bazaar test repository NOT FOUND. Skipping functional tests !!! CVS test repository NOT FOUND. Skipping functional tests !!! Darcs test repository NOT FOUND. Skipping functional tests !!! Filesystem test repository NOT FOUND. Skipping functional tests !!! Git test repository NOT FOUND. Skipping functional tests !!! Mercurial test repository NOT FOUND. Skipping functional tests !!! Subversion test repository NOT FOUND. Skipping functional tests !!! Run options: # Running tests: ...............................................................................................................................F.F..FF.FFF....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F....F..FFF............................F.....F.F.F.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... Finished tests in 384.214788s, 2.9827 tests/s, 12.7247 assertions/s. 1) Failure: test_index(BoardsControllerTest) [/var/www/redmine-trunk.local.lan/test/functional/boards_controller_test.rb:29]: Expected response to be a <:success>, but was <302> 2) Failure: test_index_should_show_messages_if_only_one_board(BoardsControllerTest) [/var/www/redmine-trunk.local.lan/test/functional/boards_controller_test.rb:44]: Expected response to be a <:success>, but was <302> 3) Failure: test_show(BoardsControllerTest) [/var/www/redmine-trunk.local.lan/test/functional/boards_controller_test.rb:51]: Expected response to be a <:success>, but was <302> 4) Failure: test_show_atom(BoardsControllerTest) [/var/www/redmine-trunk.local.lan/test/functional/boards_controller_test.rb:100]: Expected response to be a <:success>, but was <302> 5) Failure: test_show_should_display_message_with_last_reply_first(BoardsControllerTest) [/var/www/redmine-trunk.local.lan/test/functional/boards_controller_test.rb:81]: Expected response to be a <:success>, but was <302> 6) Failure: test_show_should_display_sticky_messages_first(BoardsControllerTest) [/var/www/redmine-trunk.local.lan/test/functional/boards_controller_test.rb:63]: Expected response to be a <:success>, but was <302> 7) Failure: test_show_with_permission_should_display_the_new_message_form(BoardsControllerTest) [/var/www/redmine-trunk.local.lan/test/functional/boards_controller_test.rb:90]: Expected response to be a <:success>, but was <403> 8) Failure: test_post_new(MessagesControllerTest) [/var/www/redmine-trunk.local.lan/test/functional/messages_controller_test.rb:112]: <nil> expected to not be nil. 9) Failure: test_show(MessagesControllerTest) [/var/www/redmine-trunk.local.lan/test/functional/messages_controller_test.rb:29]: Expected response to be a <:success>, but was <302> 10) Failure: test_show_should_contain_reply_field_tags_for_quoting(MessagesControllerTest) [/var/www/redmine-trunk.local.lan/test/functional/messages_controller_test.rb:39]: Expected response to be a <:success>, but was <403> 11) Failure: test_show_with_pagination(MessagesControllerTest) [/var/www/redmine-trunk.local.lan/test/functional/messages_controller_test.rb:55]: Expected response to be a <:success>, but was <302> 12) Failure: test_show_with_reply_permission(MessagesControllerTest) [/var/www/redmine-trunk.local.lan/test/functional/messages_controller_test.rb:66]: Expected response to be a <:success>, but was <403> 13) Failure: test_index_with_project(NewsControllerTest) [/var/www/redmine-trunk.local.lan/test/functional/news_controller_test.rb:37]: Expected response to be a <:success>, but was <302> 14) Failure: test_show(NewsControllerTest) [/var/www/redmine-trunk.local.lan/test/functional/news_controller_test.rb:49]: Expected response to be a <:success>, but was <302> 15) Failure: test_show_should_show_attachments(NewsControllerTest) [/var/www/redmine-trunk.local.lan/test/functional/news_controller_test.rb:60]: Expected response to be a <:success>, but was <302> 16) Failure: test_existing_new_news(PreviewsControllerTest) [/var/www/redmine-trunk.local.lan/test/functional/previews_controller_test.rb:75]: <#<News id: 2, project_id: 1, title: "100,000 downloads for eCookbook", summary: "eCookbook 1.0 have downloaded 100,000 times", description: "eCookbook 1.0 have downloaded 100,000 times", author_id: 2, created_on: "2006-07-19 20:42:58", comments_count: 0>> expected but was <nil>. 1146 tests, 4889 assertions, 16 failures, 0 errors, 0 skips ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux] Run options: # Running tests: ...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................FFEF.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... Finished tests in 179.861656s, 5.6210 tests/s, 17.9638 assertions/s. 1) Failure: test_GET_/news.json_should_return_news(Redmine::ApiTest::NewsTest) [/var/www/redmine-trunk.local.lan/test/integration/api_test/news_test.rb:57]: Expected nil to be a kind of Hash, not NilClass. 2) Failure: test_GET_/news.xml_should_return_news(Redmine::ApiTest::NewsTest) [/var/www/redmine-trunk.local.lan/test/integration/api_test/news_test.rb:40]: expected tag, but no tag found matching {:tag=>"news", :attributes=>{:type=>"array"}, :child=>{:tag=>"news", :child=>{:tag=>"id", :content=>"2"}}} in: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><news total_count=\"0\" offset=\"0\" limit=\"25\" type=\"array\"></news>" 3) Failure: test_GET_/projects/:project_id/news.xml_should_return_news(Redmine::ApiTest::NewsTest) [/var/www/redmine-trunk.local.lan/test/integration/api_test/news_test.rb:64]: expected tag, but no tag found matching {:tag=>"news", :attributes=>{:type=>"array"}, :child=>{:tag=>"news", :child=>{:tag=>"id", :content=>"2"}}} in: " " 4) Error: test_GET_/projects/:project_id/news.json_should_return_news(Redmine::ApiTest::NewsTest): MultiJson::LoadError: JSON::ParserError /usr/local/rvm/gems/ruby-2.0.0-p247@redmine_trunk/gems/multi_json-1.8.2/lib/multi_json/adapter.rb:19:in `load' /usr/local/rvm/gems/ruby-2.0.0-p247@redmine_trunk/gems/multi_json-1.8.2/lib/multi_json.rb:120:in `load' /usr/local/rvm/gems/ruby-2.0.0-p247@redmine_trunk/gems/activesupport-3.2.13/lib/active_support/json/decoding.rb:15:in `decode' /var/www/redmine-trunk.local.lan/test/integration/api_test/news_test.rb:78:in `block in <class:NewsTest>' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1301:in `run' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit/testcase.rb:17:in `run' /usr/local/rvm/gems/ruby-2.0.0-p247@redmine_trunk/gems/activesupport-3.2.13/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' /usr/local/rvm/gems/ruby-2.0.0-p247@redmine_trunk/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:447:in `_run__703544101__setup__655516421__callbacks' /usr/local/rvm/gems/ruby-2.0.0-p247@redmine_trunk/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback' /usr/local/rvm/gems/ruby-2.0.0-p247@redmine_trunk/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' /usr/local/rvm/gems/ruby-2.0.0-p247@redmine_trunk/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks' /usr/local/rvm/gems/ruby-2.0.0-p247@redmine_trunk/gems/activesupport-3.2.13/lib/active_support/testing/setup_and_teardown.rb:35:in `run' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:919:in `block in _run_suite' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `map' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `_run_suite' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:657:in `block in _run_suites' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `each' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `_run_suites' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:867:in `_run_anything' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1060:in `run_tests' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1047:in `block in _run' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `each' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `_run' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1035:in `run' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:21:in `run' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:774:in `run' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:366:in `block (2 levels) in autorun' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:27:in `run_once' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:365:in `block in autorun' 1011 tests, 3231 assertions, 3 failures, 1 errors, 0 skips ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux] root@ubuntu:/var/www/redmine-trunk.local.lan#
Please consider these issues, and my safety recommendations about them, carefully.
Regards,
Mischa.