From: Jean-Philippe Lang Date: Sat, 7 Apr 2007 20:27:19 +0000 (+0000) Subject: Added permissions report (link available on roles list view). X-Git-Tag: 0.5.0~11 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bd9a44c2254ab785014207cb07f8b2fff1068b34;p=redmine.git Added permissions report (link available on roles list view). git-svn-id: http://redmine.rubyforge.org/svn/trunk@433 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index d0dd8eb47..0eba46d1e 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -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 diff --git a/app/views/roles/list.rhtml b/app/views/roles/list.rhtml index a27af8c85..e3e576ed1 100644 --- a/app/views/roles/list.rhtml +++ b/app/views/roles/list.rhtml @@ -27,4 +27,6 @@ -<%= pagination_links_full @role_pages %> \ No newline at end of file +

<%= pagination_links_full @role_pages %>

+ +

<%= link_to l(:label_permissions_report), :action => 'report' %>

diff --git a/app/views/roles/report.rhtml b/app/views/roles/report.rhtml new file mode 100644 index 000000000..61e1e18e4 --- /dev/null +++ b/app/views/roles/report.rhtml @@ -0,0 +1,32 @@ +

<%=l(:label_permissions_report)%>

+ +<%= start_form_tag({:action => 'report'}, :id => 'permissions_form') %> + + + + + + + + +<% permissions = @permissions.group_by {|p| p.group_id } %> +<% permissions.keys.sort.each do |group_id| %> + + + <% @roles.each do |role| %><% end %> + + <% permissions[group_id].each do |p| %> + "> + + <% @roles.each do |role| %> + + <% end %> + + <% end %> +<% reset_cycle +end %> + +
<%=l(:label_permissions)%><%= l(:label_role_plural) %>
<%= l(Permission::GROUPS[group_id]) %><%= role.name %>
<%= l(p.description.to_sym) %><%= check_box_tag "permission_ids[#{role.id}][]", p.id, (role.permissions.include? p) %>
+

<%= check_all_links 'permissions_form' %>

+

<%= submit_tag l(:button_save) %>

+<%= end_form_tag %> \ No newline at end of file diff --git a/lang/de.yml b/lang/de.yml index 024c71950..254dec4d7 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -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 diff --git a/lang/en.yml b/lang/en.yml index 07dea3ced..3193e9c3d 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -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 diff --git a/lang/es.yml b/lang/es.yml index 391cb085e..393d473cf 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -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 diff --git a/lang/fr.yml b/lang/fr.yml index aeac0e72e..584c35dde 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -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 diff --git a/lang/it.yml b/lang/it.yml index 4fc22aeed..a7379115e 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -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 diff --git a/lang/ja.yml b/lang/ja.yml index 67f8b2be5..710fef5aa 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -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: 変更 diff --git a/lang/zh.yml b/lang/zh.yml index 471039ec8..eede38687 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -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: 提交 diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index ada2b67cd..7461c74a3 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -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 *************/