Index: config/locales/en.yml
===================================================================
--- config/locales/en.yml (revision 12982)
+++ config/locales/en.yml (working copy)
@@ -420,6 +420,7 @@
permission_manage_project_activities: Manage project activities
permission_manage_versions: Manage versions
permission_manage_categories: Manage issue categories
+ permission_view_activity: View Activity
permission_view_issues: View Issues
permission_add_issues: Add issues
permission_edit_issues: Edit issues
Index: config/locales/en-GB.yml
===================================================================
--- config/locales/en-GB.yml (revision 12982)
+++ config/locales/en-GB.yml (working copy)
@@ -381,6 +381,7 @@
permission_manage_project_activities: Manage project activities
permission_manage_versions: Manage versions
permission_manage_categories: Manage issue categories
+ permission_view_activity: View Activity
permission_view_issues: View Issues
permission_add_issues: Add issues
permission_edit_issues: Edit issues
Index: lib/redmine.rb
===================================================================
--- lib/redmine.rb (revision 12982)
+++ lib/redmine.rb (working copy)
@@ -80,7 +80,8 @@
# Permissions
Redmine::AccessControl.map do |map|
- map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true, :read => true
+ map.permission :view_project, {:projects => [:show]}, :public => true, :read => true
+ map.permission :view_activity, {:activities => [:index]}, :read => true
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: app/views/projects/index.html.erb
===================================================================
--- app/views/projects/index.html.erb (revision 12982)
+++ app/views/projects/index.html.erb (working copy)
@@ -3,12 +3,7 @@
<% end %>
- <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') + ' |' if User.current.allowed_to?(:add_project, nil, :global => true) %>
- <%= link_to(l(:label_issue_view_all), issues_path) + ' |' if User.current.allowed_to?(:view_issues, nil, :global => true) %>
- <%= link_to(l(:label_overall_spent_time), time_entries_path) + ' |' if User.current.allowed_to?(:view_time_entries, nil, :global => true) %>
- <%= link_to l(:label_overall_activity),
- { :controller => 'activities', :action => 'index',
- :id => nil } %>
+ <%= render_project_action_links %>
<%= l(:label_project_plural) %>
Index: app/helpers/projects_helper.rb
===================================================================
--- app/helpers/projects_helper.rb (revision 12982)
+++ app/helpers/projects_helper.rb (working copy)
@@ -51,6 +51,15 @@
content_tag('select', options.html_safe, :name => 'project[parent_id]', :id => 'project_parent_id')
end
+ def render_project_action_links
+ links = []
+ links << link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true)
+ links << link_to(l(:label_issue_view_all), issues_path) if User.current.allowed_to?(:view_issues, nil, :global => true)
+ links << link_to(l(:label_overall_spent_time), time_entries_path) if User.current.allowed_to?(:view_time_entries, nil, :global => true)
+ links << link_to(l(:label_overall_activity), { :controller => 'activities', :action => 'index', :id => nil }) if User.current.allowed_to?(:view_activity, nil, :global => true)
+ links.join(" | ").html_safe
+ end
+
# Renders the projects index
def render_project_hierarchy(projects)
render_project_nested_lists(projects) do |project|
Index: app/controllers/users_controller.rb
===================================================================
--- app/controllers/users_controller.rb (revision 12982)
+++ app/controllers/users_controller.rb (working copy)
@@ -61,9 +61,12 @@
def show
# show projects based on current user visibility
@memberships = @user.memberships.where(Project.visible_condition(User.current)).all
+ @events_by_day = []
- events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 10)
- @events_by_day = events.group_by(&:event_date)
+ if User.current.allowed_to?(:view_activity, nil, :global => true)
+ events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 10)
+ @events_by_day = events.group_by(&:event_date)
+ end
unless User.current.admin?
if !@user.active? || (@user != User.current && @memberships.empty? && events.empty?)
Index: app/controllers/activities_controller.rb
===================================================================
--- app/controllers/activities_controller.rb (revision 12982)
+++ app/controllers/activities_controller.rb (working copy)
@@ -18,6 +18,7 @@
class ActivitiesController < ApplicationController
menu_item :activity
before_filter :find_optional_project
+ before_filter :authorize_global, :only => [ :index ]
accept_rss_auth :index
def index