dalyons / redmine-todos-scrum-plugin

A scrum-like todos plugin for Redmine. Allows easy creation and management of infinitely nestable todo lists on a per project basis, that in the future will be able to be organised into sprints(or releases). Also provides global 'My Todos' for all projects. Todos can be allocated to uses, and tied to Redmine Issues.
143 stars 43 forks source link

Menu shows "My Todos" link for not-allowed users #13

Closed fnordfish closed 14 years ago

fnordfish commented 14 years ago

This patch adds a check, if the current user is allowed to "use_personal_todos"

diff --git a/init.rb b/init.rb
index 90bc35a..a926102 100644
--- a/init.rb
+++ b/init.rb
@@ -55,7 +55,10 @@ Redmine::Plugin.register :redmine_todos_plugin do
   end

   menu :top_menu, :mytodos, { :controller => 'mytodos', :action => 'index' }, 
-      :caption => :my_todos_title #, :public => false
+       :caption => :my_todos_title,
+       :if => Proc.new {
+          User.current.allowed_to?(:use_personal_todos, nil, :global => true)
+        }

   menu :project_menu, :todos, {:controller => 'todos', :action => 'index'}, 
       :caption => :label_todo_plural, :after => :new_issue, :param => :project_id
dalyons commented 14 years ago

Thank you for this, have applied this patch! :)