Index: app/helpers/application_helper.rb =================================================================== --- app/helpers/application_helper.rb (revision 15942) +++ app/helpers/application_helper.rb (working copy) @@ -48,7 +48,7 @@ def link_to_user(user, options={}) if user.is_a?(User) name = h(user.name(options[:format])) - if user.active? || (User.current.admin? && user.logged?) + if (user.active? || (User.current.admin? && user.logged?)) && (User.current.admin? && (not User.current.allowed_to?(:hide_public_projects, nil, :global => true))) link_to name, user_path(user), :class => user.css_classes else name Index: app/helpers/projects_helper.rb =================================================================== --- app/helpers/projects_helper.rb (revision 15942) +++ app/helpers/projects_helper.rb (working copy) @@ -48,16 +48,18 @@ def render_project_action_links links = [] - if User.current.allowed_to?(:add_project, nil, :global => true) - links << link_to(l(:label_project_new), new_project_path, :class => 'icon icon-add') + if (not User.current.allowed_to?(:hide_public_projects, nil, :global => true)) + if User.current.allowed_to?(:add_project, nil, :global => true) + links << link_to(l(:label_project_new), new_project_path, :class => 'icon icon-add') + end + if User.current.allowed_to?(:view_issues, nil, :global => true) + links << link_to(l(:label_issue_view_all), issues_path) + end + if User.current.allowed_to?(:view_time_entries, nil, :global => true) + links << link_to(l(:label_overall_spent_time), time_entries_path) + end + links << link_to(l(:label_overall_activity), activity_path) end - if User.current.allowed_to?(:view_issues, nil, :global => true) - links << link_to(l(:label_issue_view_all), issues_path) - end - if User.current.allowed_to?(:view_time_entries, nil, :global => true) - links << link_to(l(:label_overall_spent_time), time_entries_path) - end - links << link_to(l(:label_overall_activity), activity_path) links.join(" | ").html_safe end @@ -64,9 +66,13 @@ # Renders the projects index def render_project_hierarchy(projects) render_project_nested_lists(projects) do |project| - s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}") - if project.description.present? - s << content_tag('div', textilizable(project.short_description, :project => project), :class => 'wiki description') + if (not User.current.logged?) || ((not User.current.admin) && (not User.current.member_of?(project)) && User.current.allowed_to?(:hide_public_projects, nil, :global => true)) + s = "" + else + s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}") + if project.description.present? + s << content_tag('div', textilizable(project.short_description, :project => project), :class => 'wiki description') + end end s end Index: app/models/user.rb =================================================================== --- app/models/user.rb (révision 15910) +++ app/models/user.rb (copie de travail) @@ -555,7 +555,7 @@ return [] if project.nil? || project.archived? if membership = membership(project) membership.roles.to_a - elsif project.is_public? + elsif project.is_public? && !allowed_to?(:hide_public_projects, nil, :global => true) project.override_roles(builtin_role) else [] Index: app/views/welcome/index.html.erb =================================================================== --- app/views/welcome/index.html.erb (revision 15942) +++ app/views/welcome/index.html.erb (working copy) @@ -11,7 +11,7 @@ <% end %> <%= call_hook(:view_welcome_index_left, :projects => @projects) %> - + <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, {:controller => 'news', :action => 'index', :key => User.current.rss_key, :format => 'atom'}, :title => "#{Setting.app_title}: #{l(:label_news_latest)}") %> Index: lib/redmine.rb =================================================================== --- lib/redmine.rb (revision 15942) +++ lib/redmine.rb (working copy) @@ -76,6 +76,7 @@ # Permissions Redmine::AccessControl.map do |map| map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true, :read => true + map.permission :hide_public_projects, {:projects => [:show]}, :require => :loggedin map.permission :search_project, {:search => :index}, :public => true, :read => true map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member Index: plugins/progressive_projects_list/lib/progressive/projects_helper_patch.rb =================================================================== --- plugins/progressive_projects_list/lib/progressive/projects_helper_patch.rb 2016-01-04 22:38:16.000000000 +0100 +++ plugins/progressive_projects_list/lib/progressive/projects_helper_patch.rb 2017-04-12 16:14:44.000000000 +0200 @@ -2,18 +2,22 @@ def self.included(base) # :nodoc: base.class_eval do - def render_project_hierarchy_with_progress_bars(projects) + def render_project_hierarchy_with_progress_bars(projects) render_project_nested_lists(projects) do |project| - s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}") - if !progressive_setting?(:show_only_for_my_projects) || User.current.member_of?(project) - if progressive_setting?(:show_project_menu) - s << render_project_menu(project) + '
'.html_safe - end - if project.description.present? && progressive_setting?(:show_project_description) - s << content_tag('div', textilizable(project.short_description, :project => project), :class => 'wiki description') - end - if progressive_setting?(:show_project_progress) && User.current.allowed_to?(:view_issues, project) - s << render_project_progress_bars(project) + if (not User.current.logged?) || ((not User.current.admin) && (not User.current.member_of?(project)) && User.current.allowed_to?(:hide_public_projects, nil, :global => true)) + s = "" + else + s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}") + if !progressive_setting?(:show_only_for_my_projects) || User.current.member_of?(project) + if progressive_setting?(:show_project_menu) + s << render_project_menu(project) + '
'.html_safe + end + if project.description.present? && progressive_setting?(:show_project_description) + s << content_tag('div', textilizable(project.short_description, :project => project), :class => 'wiki description') + end + if progressive_setting?(:show_project_progress) && User.current.allowed_to?(:view_issues, project) + s << render_project_progress_bars(project) + end end end s @@ -69,3 +73,4 @@ unless ProjectsHelper.include? Progressive::ProjectsHelperPatch ProjectsHelper.send(:include, Progressive::ProjectsHelperPatch) end +