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 = []
if event.respond_to?(:changed_data) and 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 ]
end
if project_ids.empty?

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

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

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

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

Loading…
Cancel
Save