What I have is a new column in the issue list that works very well.
init.rb
require 'redmine'
Redmine::Plugin.register :test do
# ...
end
Issue.include IssuePatch
IssueQuery.include IssueQueryPatch
issue_query_patch.rb
module IssueQueryPatch
def self.included(base)
base.class_eval do
# TODO : add restriction
self.available_columns << QueryColumn.new(
:calcul_something,
:caption => :Something
))
end
end
end
issue_patch.rb require_dependency 'issue'
module IssuePatch
def self.included(base)
def calcul_something
return some_data
end
end
end
The issue I'm facing is that I want only some users (admin for example) be able to see that new column BUT in init.rb the current user is not already loaded and is anonymous so I cannot check its status.
In the official Redmine Github, you can see that User.current
is used.
Do I have to make my patches modules to be loaded later so that the user is loaded (how is it even possible and how to do that) or is there a trick ?