From b8a2d0cee7c51f70e07a84b87c1e37d960682180 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Mon, 26 Jan 2009 14:44:04 -0800 Subject: [PATCH] Wrapped edit form and link in a check for edit_rate permissions. #2031 --- lib/rate_project_hook.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/rate_project_hook.rb b/lib/rate_project_hook.rb index c869e4b..ad968e7 100644 --- a/lib/rate_project_hook.rb +++ b/lib/rate_project_hook.rb @@ -37,6 +37,8 @@ class RateProjectHook < Redmine::Hook::ViewListener content << "#{number_to_currency(rate.amount)} " end + if (User.current.allowed_to?(:edit_rate, project) || User.current.admin?) + url = { :controller => 'rates', :action => 'create', @@ -62,7 +64,10 @@ class RateProjectHook < Redmine::Hook::ViewListener form << submit_tag(l(:rate_label_set_rate), :class => "small") content << form + end else + if (User.current.allowed_to?(:edit_rate, project) || User.current.admin?) + content << content_tag(:strong, link_to(number_to_currency(rate.amount), { :controller => 'users', :action => 'edit', @@ -71,7 +76,9 @@ class RateProjectHook < Redmine::Hook::ViewListener :protocol => Setting.protocol, :host => Setting.host_name })) - + else + content << content_tag(:strong, number_to_currency(rate.amount)) + end end return content_tag(:td, content, :align => 'left', :id => "rate_#{project.id}_#{member.user.id}" ) end