Wrapped edit form and link in a check for edit_rate permissions. #2031
This commit is contained in:
1 parent
ba0ee9b6f8
commit
b8a2d0cee7
1 file changed
+8
-1
@@ -37,6 +37,8 @@ class RateProjectHook < Redmine::Hook::ViewListener
|
|||||||
content << "<em>#{number_to_currency(rate.amount)}</em> "
|
content << "<em>#{number_to_currency(rate.amount)}</em> "
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (User.current.allowed_to?(:edit_rate, project) || User.current.admin?)
|
||||||
|
|
||||||
url = {
|
url = {
|
||||||
:controller => 'rates',
|
:controller => 'rates',
|
||||||
:action => 'create',
|
:action => 'create',
|
||||||
@@ -62,7 +64,10 @@ class RateProjectHook < Redmine::Hook::ViewListener
|
|||||||
form << submit_tag(l(:rate_label_set_rate), :class => "small")
|
form << submit_tag(l(:rate_label_set_rate), :class => "small")
|
||||||
|
|
||||||
content << form
|
content << form
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
if (User.current.allowed_to?(:edit_rate, project) || User.current.admin?)
|
||||||
|
|
||||||
content << content_tag(:strong, link_to(number_to_currency(rate.amount), {
|
content << content_tag(:strong, link_to(number_to_currency(rate.amount), {
|
||||||
:controller => 'users',
|
:controller => 'users',
|
||||||
:action => 'edit',
|
:action => 'edit',
|
||||||
@@ -71,7 +76,9 @@ class RateProjectHook < Redmine::Hook::ViewListener
|
|||||||
:protocol => Setting.protocol,
|
:protocol => Setting.protocol,
|
||||||
:host => Setting.host_name
|
:host => Setting.host_name
|
||||||
}))
|
}))
|
||||||
|
else
|
||||||
|
content << content_tag(:strong, number_to_currency(rate.amount))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return content_tag(:td, content, :align => 'left', :id => "rate_#{project.id}_#{member.user.id}" )
|
return content_tag(:td, content, :align => 'left', :id => "rate_#{project.id}_#{member.user.id}" )
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user