Merge pull request #286 from opf/feature/rails3_repair_activity

repair activity module
pull/280/merge
sschu 11 years ago
commit 2bca45aa87
  1. 2
      app/controllers/activities_controller.rb
  2. 1
      config/locales/de.yml
  3. 1
      config/locales/en.yml
  4. 4
      lib/redmine.rb
  5. 21
      lib/redmine/access_control.rb

@ -83,7 +83,7 @@ class ActivitiesController < ApplicationController
project_ids = [] project_ids = []
if event.respond_to?(:changed_data) and event.changed_data['project_id'] if event.respond_to?(:changed_data) and event.changed_data['project_id']
project_ids = event.changed_data['project_id'] project_ids = event.changed_data['project_id']
elsif event.respond_to?(:project_id) elsif event.respond_to?(:project_id) or event.journaled.respond_to?(:project_id)
project_ids = [ event.project_id ] project_ids = [ event.project_id ]
end end
if project_ids.empty? if project_ids.empty?

@ -1131,6 +1131,7 @@ de:
permission_view_wiki_edits: "Wiki-Versionsgeschichte ansehen" permission_view_wiki_edits: "Wiki-Versionsgeschichte ansehen"
permission_view_wiki_pages: "Wiki ansehen" permission_view_wiki_pages: "Wiki ansehen"
project_module_activity: "Aktivität"
project_module_boards: "Foren" project_module_boards: "Foren"
project_module_calendar: "Kalender" project_module_calendar: "Kalender"
project_module_documents: "Dokumente" project_module_documents: "Dokumente"

@ -1106,6 +1106,7 @@ en:
permission_view_wiki_edits: "View wiki history" permission_view_wiki_edits: "View wiki history"
permission_view_wiki_pages: "View wiki" permission_view_wiki_pages: "View wiki"
project_module_activity: "Activity"
project_module_boards: "Forums" project_module_boards: "Forums"
project_module_calendar: "Calendar" project_module_calendar: "Calendar"
project_module_documents: "Documents" project_module_documents: "Documents"

@ -168,6 +168,8 @@ Redmine::AccessControl.map do |map|
map.permission :view_calendar, :'issues/calendars' => [:index] map.permission :view_calendar, :'issues/calendars' => [:index]
end end
map.project_module :activity
map.project_module :timelines do |map| map.project_module :timelines do |map|
map.permission :manage_project_configuration, map.permission :manage_project_configuration,
:require => :member :require => :member
@ -369,5 +371,3 @@ Redmine::WikiFormatting.map do |format|
end end
ActionView::Template.register_template_handler :rsb, Redmine::Views::ApiTemplateHandler ActionView::Template.register_template_handler :rsb, Redmine::Views::ApiTemplateHandler
Redmine::AccessControl.available_project_modules << :activity

@ -19,6 +19,8 @@ module Redmine
yield mapper yield mapper
@permissions ||= [] @permissions ||= []
@permissions += mapper.mapped_permissions @permissions += mapper.mapped_permissions
@project_modules_without_permissions ||= []
@project_modules_without_permissions += mapper.project_modules_without_permissions
end end
def permissions def permissions
@ -50,7 +52,9 @@ module Redmine
end end
def available_project_modules def available_project_modules
@available_project_modules ||= @permissions.collect(&:project_module).uniq.compact @available_project_modules ||= (
@permissions.collect(&:project_module) + @project_modules_without_permissions
).uniq.compact
end end
def modules_permissions(modules) def modules_permissions(modules)
@ -61,6 +65,7 @@ module Redmine
class Mapper class Mapper
def initialize def initialize
@project_module = nil @project_module = nil
@project_modules_without_permissions = []
end end
def permission(name, hash, options={}) def permission(name, hash, options={})
@ -70,14 +75,22 @@ module Redmine
end end
def project_module(name, options={}) def project_module(name, options={})
@project_module = name if block_given?
yield self @project_module = name
@project_module = nil yield self
@project_module = nil
else
@project_modules_without_permissions << name
end
end end
def mapped_permissions def mapped_permissions
@permissions @permissions
end end
def project_modules_without_permissions
@project_modules_without_permissions
end
end end
class Permission class Permission

Loading…
Cancel
Save