Added permissions report (link available on roles list view).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@433 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-04-07 20:27:19 +00:00
parent 30734ba8e8
commit bd9a44c225
11 changed files with 57 additions and 2 deletions

View File

@ -99,4 +99,17 @@ class RolesController < ApplicationController
@trackers = Tracker.find(:all, :order => 'position')
@statuses = IssueStatus.find(:all, :include => :workflows, :order => 'position')
end
def report
@roles = Role.find :all
@permissions = Permission.find :all, :conditions => ["is_public=?", false], :order => 'sort'
if request.post?
@roles.each do |role|
role.permissions = Permission.find(params[:permission_ids] ? (params[:permission_ids][role.id.to_s] || []) : [] )
end
Permission.allowed_to_role_expired
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'list'
end
end
end

View File

@ -27,4 +27,6 @@
</tbody>
</table>
<%= pagination_links_full @role_pages %>
<p><%= pagination_links_full @role_pages %></p>
<p><%= link_to l(:label_permissions_report), :action => 'report' %></p>

View File

@ -0,0 +1,32 @@
<h2><%=l(:label_permissions_report)%></h2>
<%= start_form_tag({:action => 'report'}, :id => 'permissions_form') %>
<table class="list">
<thead><tr>
<th><%=l(:label_permissions)%></th>
<th colspan="<%= @roles.length %>"><%= l(:label_role_plural) %></th>
</tr>
</thead>
<tbody>
<% permissions = @permissions.group_by {|p| p.group_id } %>
<% permissions.keys.sort.each do |group_id| %>
<tr>
<th><%= l(Permission::GROUPS[group_id]) %></th>
<% @roles.each do |role| %><th align="center"><small><%= role.name %></small></th><% end %>
</tr>
<% permissions[group_id].each do |p| %>
<tr class="<%= cycle("odd", "even") %>">
<td><%= l(p.description.to_sym) %></td>
<% @roles.each do |role| %>
<td align="center"><%= check_box_tag "permission_ids[#{role.id}][]", p.id, (role.permissions.include? p) %></td>
<% end %>
</tr>
<% end %>
<% reset_cycle
end %>
</tbody>
</table>
<p><%= check_all_links 'permissions_form' %></p>
<p><%= submit_tag l(:button_save) %></p>
<%= end_form_tag %>

View File

@ -355,6 +355,7 @@ label_diff_inline: inline
label_diff_side_by_side: side by side
label_options: Options
label_copy_workflow_from: Copy workflow from
label_permissions_report: Permissions report
button_login: Einloggen
button_submit: OK

View File

@ -355,6 +355,7 @@ label_diff_inline: inline
label_diff_side_by_side: side by side
label_options: Options
label_copy_workflow_from: Copy workflow from
label_permissions_report: Permissions report
button_login: Login
button_submit: Submit

View File

@ -355,6 +355,7 @@ label_diff_inline: inline
label_diff_side_by_side: side by side
label_options: Options
label_copy_workflow_from: Copy workflow from
label_permissions_report: Permissions report
button_login: Conexión
button_submit: Someter

View File

@ -355,6 +355,7 @@ label_diff_inline: en ligne
label_diff_side_by_side: côte à côte
label_options: Options
label_copy_workflow_from: Copier le workflow de
label_permissions_report: Synthèse des permissions
button_login: Connexion
button_submit: Soumettre

View File

@ -355,6 +355,7 @@ label_diff_inline: inline
label_diff_side_by_side: side by side
label_options: Options
label_copy_workflow_from: Copy workflow from
label_permissions_report: Permissions report
button_login: Login
button_submit: Invia

View File

@ -356,6 +356,7 @@ label_diff_inline: インライン
label_diff_side_by_side: 横に並べる
label_options: Options
label_copy_workflow_from: Copy workflow from
label_permissions_report: Permissions report
button_login: ログイン
button_submit: 変更

View File

@ -358,6 +358,7 @@ label_diff_inline: inline
label_diff_side_by_side: side by side
label_options: Options
label_copy_workflow_from: Copy workflow from
label_permissions_report: Permissions report
button_login: 登录
button_submit: 提交

View File

@ -302,9 +302,10 @@ table.list thead th {
}
table.list tbody th {
font-weight: normal;
font-weight: bold;
background: #eed;
border: 1px solid #d7d7d7;
color: #777;
}
/********** Validation error messages *************/