diff -ur redmine_3629/app/controllers/projects_controller.rb redmine/app/controllers/projects_controller.rb --- redmine_3629/app/controllers/projects_controller.rb 2010-04-08 12:11:59.000000000 +0400 +++ redmine/app/controllers/projects_controller.rb 2010-04-09 10:01:51.640590759 +0400 @@ -152,6 +152,9 @@ @open_issues_by_tracker = Issue.visible.count(:group => :tracker, :include => [:project, :status, :tracker], :conditions => ["(#{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=? AND #{Issue.table_name}.is_private=?", false, true]) @total_issues_by_tracker = Issue.visible.count(:group => :tracker, :include => [:project, :status, :tracker], :conditions => cond) @@ -331,6 +334,11 @@ @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty? events = @activity.events(@date_from, @date_to) + + # The private issues should be removed from events + events.each do |event| + events.delete(event) if event.kind_of?(Issue) && !event.visible?(User.current, Project.find(event.project)) + end if events.empty? || stale?(:etag => [events.first, User.current]) respond_to do |format| diff -ur redmine_3629/app/models/issue.rb redmine/app/models/issue.rb --- redmine_3629/app/models/issue.rb 2010-04-08 12:11:59.000000000 +0400 +++ redmine/app/models/issue.rb 2010-04-09 15:25:11.948089072 +0400 @@ -74,8 +74,9 @@ after_destroy :update_parent_attributes # Returns true if usr or current user is allowed to view the issue - def visible?(usr=nil) - (usr || User.current).allowed_to?(:view_issues, self.project) + def visible?(usr=User.current, project=self.project) + is_private==false && usr.allowed_to?(:view_issues, project) || + is_private==true && (usr.allowed_to?(:view_private_issues, project) || author == usr || assigned_to == usr || watched_by?(usr)) end def after_initialize @@ -204,6 +205,7 @@ category_id assigned_to_id priority_id + is_private fixed_version_id subject description @@ -716,6 +718,11 @@ if assigned_to.nil? && category && category.assigned_to self.assigned_to = category.assigned_to end + if User.current.allowed_to?(:add_private_issues, self.project) + self.is_private=1 unless User.current.allowed_to?(:add_issues, self.project) + else + self.is_private=0 + end end # Updates start/due dates of following issues diff -ur redmine_3629/app/views/issues/_form.rhtml redmine/app/views/issues/_form.rhtml --- redmine_3629/app/views/issues/_form.rhtml 2010-04-08 12:11:59.000000000 +0400 +++ redmine/app/views/issues/_form.rhtml 2010-04-09 14:11:07.304447444 +0400 @@ -25,6 +25,9 @@
<%= render :partial => 'attributes' %>
+<% if User.current.allowed_to?(:add_issues, @project) && User.current.allowed_to?(:add_private_issues, @project) %> +

<%=f.check_box :is_private %>

+<% end%> <% if @issue.new_record? %>

<%= render :partial => 'attachments/form' %>

diff -ur redmine_3629/app/views/issues/_list.rhtml redmine/app/views/issues/_list.rhtml --- redmine_3629/app/views/issues/_list.rhtml 2010-04-08 12:11:59.000000000 +0400 +++ redmine/app/views/issues/_list.rhtml 2010-04-09 15:30:25.912189407 +0400 @@ -24,11 +24,13 @@ <% previous_group = group %> <% end %> + <% if issue.visible? %> "> <%= 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 -ur redmine_3629/app/views/issues/_list_simple.rhtml redmine/app/views/issues/_list_simple.rhtml --- redmine_3629/app/views/issues/_list_simple.rhtml 2010-04-08 12:11:59.000000000 +0400 +++ redmine/app/views/issues/_list_simple.rhtml 2010-04-09 15:31:32.377528332 +0400 @@ -9,6 +9,7 @@ <% for issue in issues %> + <% if issue.visible? %> <%= check_box_tag("ids[]", issue.id, false, :style => 'display:none;') %> @@ -20,6 +21,7 @@ <%= link_to h(truncate(issue.subject, :length => 60)), :controller => 'issues', :action => 'show', :id => issue %> (<%=h issue.status %>) + <% end %> <% end %> diff -ur redmine_3629/app/views/issues/show.rhtml redmine/app/views/issues/show.rhtml --- redmine_3629/app/views/issues/show.rhtml 2010-04-08 12:11:59.000000000 +0400 +++ redmine/app/views/issues/show.rhtml 2010-04-09 15:15:32.905963122 +0400 @@ -1,3 +1,5 @@ +<% if @issue.visible? %> + <%= render :partial => 'action_menu' %>

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

@@ -40,6 +42,9 @@ <% if @issue.estimated_hours %> <%=l(:field_estimated_hours)%>:<%= l_hours(@issue.estimated_hours) %> <% end %> + <% if @issue.is_private %> + <%=l(:field_is_private)%>:<%=l(:general_text_Yes)%> + <% end %> <%= render_custom_fields_rows(@issue) %> <%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %> @@ -130,4 +135,7 @@ <%= stylesheet_link_tag 'context_menu' %> <% end %> -<%= javascript_tag "new ContextMenu('#{url_for(:controller => 'issues', :action => 'context_menu')}')" %> \ +<%= javascript_tag "new ContextMenu('#{url_for(:controller => 'issues', :action => 'context_menu')}')" %> +<% else %> +

<%=l(:label_access_denied)%>

+<% end %> diff -ur redmine_3629/app/views/projects/show.rhtml redmine/app/views/projects/show.rhtml --- redmine_3629/app/views/projects/show.rhtml 2010-04-08 12:11:59.000000000 +0400 +++ redmine/app/views/projects/show.rhtml 2010-04-09 15:33:58.651978555 +0400 @@ -33,6 +33,7 @@ "tracker_id" => tracker.id %>: <%= l(:label_x_open_issues_abbr_on_total, :count => @open_issues_by_tracker[tracker].to_i, :total => @total_issues_by_tracker[tracker].to_i) %> + (<%= @private_issues_by_tracker[tracker] || 0 %> <%= l(:label_private_issues, @private_issues_by_tracker[tracker] || 0)%>) <% end %> diff -ur redmine_3629/config/locales/en.yml redmine/config/locales/en.yml --- redmine_3629/config/locales/en.yml 2010-04-08 12:11:59.000000000 +0400 +++ redmine/config/locales/en.yml 2010-04-08 12:57:27.000000000 +0400 @@ -275,6 +275,7 @@ field_default_value: Default value field_comments_sorting: Display comments field_parent_title: Parent page + field_is_private: Private issue field_editable: Editable field_watcher: Watcher field_identity_url: OpenID URL @@ -347,6 +348,8 @@ permission_manage_categories: Manage issue categories permission_view_issues: View Issues 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 @@ -402,6 +405,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 @@ -519,6 +523,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_x_open_issues_abbr_on_total: diff -ur redmine_3629/config/locales/ru.yml redmine/config/locales/ru.yml --- redmine_3629/config/locales/ru.yml 2010-04-08 12:11:59.000000000 +0400 +++ redmine/config/locales/ru.yml 2010-04-08 13:06:36.000000000 +0400 @@ -354,6 +354,7 @@ field_port: Порт field_possible_values: Возможные значения field_priority: Приоритет + field_is_private: Конфиденциальная задача field_project: Проект field_redirect_existing_links: Перенаправить существующие ссылки field_regexp: Регулярное выражение @@ -394,6 +395,7 @@ gui_validation_error_plural5: "{{count}} ошибок" label_activity: Активность + label_access_denied: Доступ запрещен label_add_another_file: Добавить ещё один файл label_added_time_by: "Добавил(а) {{author}} {{age}} назад" label_added: добавлено @@ -593,6 +595,10 @@ label_not_contains: не содержит label_not_equals: не соответствует label_open_issues: открыт + label_private_issues_plural2: конфиденциальных + label_private_issues_plural5: конфиденциальных + label_private_issues_plural: конфиденциальных + label_private_issues: конфиденциальная label_open_issues_plural: открыто label_open_issues_plural2: открыто label_open_issues_plural5: открыто @@ -783,6 +789,8 @@ permission_add_issues: Добавление задач permission_add_issue_notes: Добавление примечаний + permission_add_private_issues: Добавление конфиденциальных задач + permission_view_private_issues: Просмотр конфиденциальных задач permission_add_issue_watchers: Добавление наблюдателей permission_add_messages: Отправка сообщений permission_browse_repository: Просмотр хранилища diff -ur redmine_3629/lib/redmine.rb redmine/lib/redmine.rb --- redmine_3629/lib/redmine.rb 2010-04-08 12:11:59.000000000 +0400 +++ redmine/lib/redmine.rb 2010-04-08 13:10:43.000000000 +0400 @@ -52,6 +52,12 @@ :queries => :index, :reports => [:issue_report, :issue_report_details]} map.permission :add_issues, {:issues => [:new, :update_form]} + 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, :update, :reply, :bulk_edit, :update_form]} map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]} map.permission :manage_subtasks, {}