Project

General

Profile

Patch #44328 » 0001-Allow-reading-issue-categories-with-the-view_issues-.patch

Jens Krämer, 2026-08-05 10:49

View differences:

lib/redmine/preparation.rb
59 59
                                        :auto_complete => [:issues],
60 60
                                        :context_menus => [:issues],
61 61
                                        :versions => [:index, :show, :status_by],
62
                                        :issue_categories => [:index, :show],
62 63
                                        :journals => [:index, :diff],
63 64
                                        :queries => :index,
64 65
                                        :reports => [:issue_report, :issue_report_details]},
test/integration/api_test/issue_categories_test.rb
34 34
    assert_select 'issue_category id', :text => '2'
35 35
  end
36 36

  
37
  test "GET /projects/:project_id/issue_categories.xml should be allowed with view_issues permission" do
38
    Role.find(1).remove_permission! :manage_categories
39

  
40
    get '/projects/1/issue_categories.xml', :headers => credentials('jsmith')
41
    assert_response :success
42
    assert_select 'issue_categories issue_category id', :text => '2'
43
  end
44

  
45
  test "GET /issue_categories/:id.xml should be allowed with view_issues permission" do
46
    Role.find(1).remove_permission! :manage_categories
47

  
48
    get '/issue_categories/2.xml', :headers => credentials('jsmith')
49
    assert_response :success
50
    assert_select 'issue_category id', :text => '2'
51
  end
52

  
53
  test "POST /projects/:project_id/issue_categories.xml should be denied without manage_categories permission" do
54
    Role.find(1).remove_permission! :manage_categories
55

  
56
    assert_no_difference 'IssueCategory.count' do
57
      post(
58
        '/projects/1/issue_categories.xml',
59
        :params => {:issue_category => {:name => 'API'}},
60
        :headers => credentials('jsmith'))
61
    end
62
    assert_response :forbidden
63
  end
64

  
37 65
  test "POST /projects/:project_id/issue_categories.xml should return create issue category" do
38 66
    assert_difference 'IssueCategory.count' do
39 67
      post(
    (1-1/1)