Project

General

Profile

Feature #1543 » view_activity_permission_trunk.patch

Patch against trunk r12982 (2.5-stable) - Michael Esemplare, 2014-03-19 07:27

View differences:

config/locales/en.yml (working copy)
420 420
  permission_manage_project_activities: Manage project activities
421 421
  permission_manage_versions: Manage versions
422 422
  permission_manage_categories: Manage issue categories
423
  permission_view_activity: View Activity
423 424
  permission_view_issues: View Issues
424 425
  permission_add_issues: Add issues
425 426
  permission_edit_issues: Edit issues
config/locales/en-GB.yml (working copy)
381 381
  permission_manage_project_activities: Manage project activities
382 382
  permission_manage_versions: Manage versions
383 383
  permission_manage_categories: Manage issue categories
384
  permission_view_activity: View Activity
384 385
  permission_view_issues: View Issues
385 386
  permission_add_issues: Add issues
386 387
  permission_edit_issues: Edit issues
lib/redmine.rb (working copy)
80 80

  
81 81
# Permissions
82 82
Redmine::AccessControl.map do |map|
83
  map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true, :read => true
83
  map.permission :view_project, {:projects => [:show]}, :public => true, :read => true
84
  map.permission :view_activity, {:activities => [:index]}, :read => true
84 85
  map.permission :search_project, {:search => :index}, :public => true, :read => true
85 86
  map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin
86 87
  map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member
app/views/projects/index.html.erb (working copy)
3 3
<% end %>
4 4

  
5 5
<div class="contextual">
6
    <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') + ' |' if User.current.allowed_to?(:add_project, nil, :global => true) %>
7
    <%= link_to(l(:label_issue_view_all), issues_path) + ' |' if User.current.allowed_to?(:view_issues, nil, :global => true) %>
8
    <%= link_to(l(:label_overall_spent_time), time_entries_path) + ' |' if User.current.allowed_to?(:view_time_entries, nil, :global => true) %>
9
    <%= link_to l(:label_overall_activity),
10
                { :controller => 'activities', :action => 'index',
11
                  :id => nil } %>
6
    <%= render_project_action_links %>
12 7
</div>
13 8

  
14 9
<h2><%= l(:label_project_plural) %></h2>
app/helpers/projects_helper.rb (working copy)
51 51
    content_tag('select', options.html_safe, :name => 'project[parent_id]', :id => 'project_parent_id')
52 52
  end
53 53

  
54
  def render_project_action_links
55
    links = []
56
    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)
57
    links << link_to(l(:label_issue_view_all), issues_path) if User.current.allowed_to?(:view_issues, nil, :global => true)
58
    links << link_to(l(:label_overall_spent_time), time_entries_path) if User.current.allowed_to?(:view_time_entries, nil, :global => true)
59
    links << link_to(l(:label_overall_activity), { :controller => 'activities', :action => 'index', :id => nil }) if User.current.allowed_to?(:view_activity, nil, :global => true)
60
    links.join(" | ").html_safe 
61
  end 
62

  
54 63
  # Renders the projects index
55 64
  def render_project_hierarchy(projects)
56 65
    render_project_nested_lists(projects) do |project|
app/controllers/users_controller.rb (working copy)
61 61
  def show
62 62
    # show projects based on current user visibility
63 63
    @memberships = @user.memberships.where(Project.visible_condition(User.current)).all
64
    @events_by_day = []
64 65

  
65
    events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 10)
66
    @events_by_day = events.group_by(&:event_date)
66
    if User.current.allowed_to?(:view_activity, nil, :global => true)
67
      events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 10)
68
      @events_by_day = events.group_by(&:event_date)
69
    end
67 70

  
68 71
    unless User.current.admin?
69 72
      if !@user.active? || (@user != User.current  && @memberships.empty? && events.empty?)
app/controllers/activities_controller.rb (working copy)
18 18
class ActivitiesController < ApplicationController
19 19
  menu_item :activity
20 20
  before_filter :find_optional_project
21
  before_filter :authorize_global, :only => [ :index ]
21 22
  accept_rss_auth :index
22 23

  
23 24
  def index
(4-4/4)