diff -ruN redmine-0.8.0-orig/app/controllers/projects_controller.rb redmine-0.8.0/app/controllers/projects_controller.rb --- redmine-0.8.0-orig/app/controllers/projects_controller.rb 2008-12-30 13:09:23.000000000 +0300 +++ redmine-0.8.0/app/controllers/projects_controller.rb 2009-01-02 05:28:24.000000000 +0300 @@ -91,9 +91,17 @@ cond = @project.project_condition(Setting.display_subprojects_issues?) Issue.visible_by(User.current) do + issue_cond = cond; + if not User.current.allowed_to?(:view_private_issues, @project) + issue_cond += " AND #{Issue.table_name}.private = false" + end @open_issues_by_tracker = Issue.count(:group => :tracker, :include => [:project, :status, :tracker], - :conditions => ["(#{cond}) AND #{IssueStatus.table_name}.is_closed=?", false]) + :conditions => ["(#{issue_cond}) AND #{IssueStatus.table_name}.is_closed=?", false]) + @private_issues_by_tracker = Issue.count(:group => :tracker, + :include => [:project, :status, :tracker], + :conditions => ["(#{cond}) AND #{IssueStatus.table_name}.is_closed=?", false], + :conditions => ["#{Issue.table_name}.private=?",true]) @total_issues_by_tracker = Issue.count(:group => :tracker, :include => [:project, :status, :tracker], :conditions => cond) diff -ruN redmine-0.8.0-orig/app/models/issue.rb redmine-0.8.0/app/models/issue.rb --- redmine-0.8.0-orig/app/models/issue.rb 2008-12-30 13:09:23.000000000 +0300 +++ redmine-0.8.0/app/models/issue.rb 2009-01-02 02:33:40.000000000 +0300 @@ -262,6 +262,10 @@ yield end end + + def visible? (usr, project) + private==false || private==true && usr.allowed_to?(:view_private_issues, project) + end def to_s "#{tracker} ##{id}: #{subject}" diff -ruN redmine-0.8.0-orig/app/views/issues/_form.rhtml redmine-0.8.0/app/views/issues/_form.rhtml --- redmine-0.8.0-orig/app/views/issues/_form.rhtml 2008-12-30 13:09:24.000000000 +0300 +++ redmine-0.8.0/app/views/issues/_form.rhtml 2009-01-02 00:08:51.000000000 +0300 @@ -41,6 +41,10 @@

<%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %>

+<% if User.current.allowed_to?(:add_private_issues, @project) %> +

<%=f.check_box :private %>

+<% end%> +
<%= render :partial => 'form_custom_fields' %> diff -ruN redmine-0.8.0-orig/app/views/issues/_list.rhtml redmine-0.8.0/app/views/issues/_list.rhtml --- redmine-0.8.0-orig/app/views/issues/_list.rhtml 2008-12-30 13:09:24.000000000 +0300 +++ redmine-0.8.0/app/views/issues/_list.rhtml 2009-01-02 02:36:16.000000000 +0300 @@ -11,11 +11,13 @@ <% issues.each do |issue| -%> - - <%= check_box_tag("ids[]", issue.id, false, :id => nil) %> - <%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %> - <% query.columns.each do |column| %><%= content_tag 'td', column_content(column, issue), :class => column.name %><% end %> - + <% if issue.visible? User.current, @project %> + + <%= check_box_tag("ids[]", issue.id, false, :id => nil) %> + <%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %> + <% query.columns.each do |column| %><%= content_tag 'td', column_content(column, issue), :class => column.name %><% end %> + + <% end %> <% end -%> diff -ruN redmine-0.8.0-orig/app/views/issues/_list_simple.rhtml redmine-0.8.0/app/views/issues/_list_simple.rhtml --- redmine-0.8.0-orig/app/views/issues/_list_simple.rhtml 2008-12-30 13:09:24.000000000 +0300 +++ redmine-0.8.0/app/views/issues/_list_simple.rhtml 2009-01-02 03:35:46.000000000 +0300 @@ -8,17 +8,19 @@ <% for issue in issues %> - - - <%= check_box_tag("ids[]", issue.id, false, :style => 'display:none;') %> - <%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %> - - <%=h issue.project.name %> - <%= issue.tracker.name %>
- <%= issue.status.name %> - <%= format_time(issue.updated_on) %> - - <%= link_to h(issue.subject), :controller => 'issues', :action => 'show', :id => issue %> - - + <% if issue.visible? User.current, @project %> + + + <%= check_box_tag("ids[]", issue.id, false, :style => 'display:none;') %> + <%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %> + + <%=h issue.project.name %> - <%= issue.tracker.name %>
+ <%= issue.status.name %> - <%= format_time(issue.updated_on) %> + + <%= link_to h(issue.subject), :controller => 'issues', :action => 'show', :id => issue %> + + + <% end %> <% end %> diff -ruN redmine-0.8.0-orig/app/views/issues/show.rhtml redmine-0.8.0/app/views/issues/show.rhtml --- redmine-0.8.0-orig/app/views/issues/show.rhtml 2008-12-30 13:09:24.000000000 +0300 +++ redmine-0.8.0/app/views/issues/show.rhtml 2009-01-02 02:45:22.000000000 +0300 @@ -1,3 +1,5 @@ +<% if @issue.visible? User.current, @project%> +
<%= link_to_if_authorized(l(:button_update), {:controller => 'issues', :action => 'edit', :id => @issue }, :onclick => 'showAndScrollTo("update", "notes"); return false;', :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %> <%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :issue_id => @issue}, :class => 'icon icon-time' %> @@ -7,6 +9,8 @@ <%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
+ +

<%= @issue.tracker.name %> #<%= @issue.id %>

@@ -42,6 +46,9 @@ <% if @issue.estimated_hours %> <%=l(:field_estimated_hours)%>:<%= lwr(:label_f_hour, @issue.estimated_hours) %> <% end %> + <% if @issue.private %> + <%=l(:field_private)%> + <% end %> <% n = 0 -%> @@ -126,3 +133,7 @@ <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %> <%= stylesheet_link_tag 'scm' %> <% end %> + +<% else %> +

<%=l(:label_access_denied)%>

+<% end %> diff -ruN redmine-0.8.0-orig/app/views/projects/show.rhtml redmine-0.8.0/app/views/projects/show.rhtml --- redmine-0.8.0-orig/app/views/projects/show.rhtml 2008-12-30 13:09:24.000000000 +0300 +++ redmine-0.8.0/app/views/projects/show.rhtml 2009-01-02 05:25:04.000000000 +0300 @@ -26,6 +26,7 @@ :set_filter => 1, "tracker_id" => tracker.id %>: <%= @open_issues_by_tracker[tracker] || 0 %> <%= lwr(:label_open_issues, @open_issues_by_tracker[tracker] || 0) %> + (<%= @private_issues_by_tracker[tracker] || 0 %> <%= lwr(:label_private_issues, @private_issues_by_tracker[tracker] || 0)%>) <%= l(:label_on) %> <%= @total_issues_by_tracker[tracker] || 0 %> <% end %> diff -ruN redmine-0.8.0-orig/db/migrate/102_add_issues_private_flag.rb redmine-0.8.0/db/migrate/102_add_issues_private_flag.rb --- redmine-0.8.0-orig/db/migrate/102_add_issues_private_flag.rb 1970-01-01 03:00:00.000000000 +0300 +++ redmine-0.8.0/db/migrate/102_add_issues_private_flag.rb 2009-01-01 12:47:54.000000000 +0300 @@ -0,0 +1,9 @@ +class AddIssuesPrivateFlag < ActiveRecord::Migration + def self.up + add_column :issues, :private, :boolean, :default => false, :null => false + end + + def self.down + remove_column :issues, :private + end +end diff -ruN redmine-0.8.0-orig/lang/en.yml redmine-0.8.0/lang/en.yml --- redmine-0.8.0-orig/lang/en.yml 2008-12-30 13:09:26.000000000 +0300 +++ redmine-0.8.0/lang/en.yml 2009-01-02 05:36:32.000000000 +0300 @@ -184,6 +184,7 @@ field_default_value: Default value field_comments_sorting: Display comments field_parent_title: Parent page +field_private: Private issue setting_app_title: Application title setting_app_subtitle: Application subtitle @@ -231,6 +232,8 @@ permission_manage_versions: Manage versions permission_manage_categories: Manage issue categories permission_add_issues: Add issues +permission_add_private_issues: Add private issues +permission_view_private_issues: View private issues permission_edit_issues: Edit issues permission_manage_issue_relations: Manage issue relations permission_add_issue_notes: Add notes @@ -283,6 +286,7 @@ project_module_repository: Repository project_module_boards: Boards +label_access_denied: Access denied label_user: User label_user_plural: Users label_user_new: New user @@ -395,6 +399,8 @@ label_public_projects: Public projects label_open_issues: open label_open_issues_plural: open +label_private_issues: private +label_private_issues_plural: private label_closed_issues: closed label_closed_issues_plural: closed label_total: Total diff -ruN redmine-0.8.0-orig/lang/ru.yml redmine-0.8.0/lang/ru.yml --- redmine-0.8.0-orig/lang/ru.yml 2008-12-30 13:09:26.000000000 +0300 +++ redmine-0.8.0/lang/ru.yml 2009-01-02 05:35:59.000000000 +0300 @@ -179,6 +179,7 @@ field_port: Порт field_possible_values: Возможные значения field_priority: Приоритет +field_private: Конфиденциальная задача field_project: Проект field_redirect_existing_links: Перенаправить существующие ссылки field_regexp: Регулярное выражение @@ -227,6 +228,7 @@ gui_validation_error_plural: %d ошибок label_activity: Активность +label_access_denied: Доступ запрещен label_add_another_file: Добавить ещё один файл label_added_time_by: Добавил(а) %s %s назад label_added: добавлено @@ -430,6 +432,10 @@ label_open_issues_plural5: открыто label_open_issues_plural: открыто label_open_issues: открыт +label_private_issues_plural2: конфиденциальных +label_private_issues_plural5: конфиденциальных +label_private_issues_plural: конфиденциальных +label_private_issues: конфиденциальная label_optional_description: Описание (опционально) label_options: Опции label_overall_activity: Сводная активность @@ -622,6 +628,8 @@ permission_view_documents: Просмотр документов permission_edit_project: Редактирование проектов permission_add_issue_notes: Добавление примечаний +permission_add_private_issues: Добавление конфиденциальных задач +permission_view_private_issues: Просмотр конфиденциальных задач permission_save_queries: Сохранение запросов permission_view_wiki_pages: Просмотр wiki permission_rename_wiki_pages: Переименование страниц wiki diff -ruN redmine-0.8.0-orig/lib/redmine.rb redmine-0.8.0/lib/redmine.rb --- redmine-0.8.0-orig/lib/redmine.rb 2008-12-30 13:09:28.000000000 +0300 +++ redmine-0.8.0/lib/redmine.rb 2009-01-02 00:47:01.000000000 +0300 @@ -35,6 +35,12 @@ :queries => :index, :reports => :issue_report}, :public => true map.permission :add_issues, {:issues => :new} + map.permission :add_private_issues, {:issues => :new} + map.permission :view_private_issues, {:projects => [:changelog, :roadmap], + :issues => [:index, :changes, :show, :context_menu], + :versions => [:show, :status_by], + :queries => :index, + :reports => :issue_report} map.permission :edit_issues, {:issues => [:edit, :reply, :bulk_edit, :destroy_attachment]} map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]} map.permission :add_issue_notes, {:issues => [:edit, :reply]}