]> source.dussan.org Git - redmine.git/commitdiff
Added permissions report (link available on roles list view).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 7 Apr 2007 20:27:19 +0000 (20:27 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 7 Apr 2007 20:27:19 +0000 (20:27 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@433 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/roles_controller.rb
app/views/roles/list.rhtml
app/views/roles/report.rhtml [new file with mode: 0644]
lang/de.yml
lang/en.yml
lang/es.yml
lang/fr.yml
lang/it.yml
lang/ja.yml
lang/zh.yml
public/stylesheets/application.css

index d0dd8eb4727582259e0e06bda4e41ccc4d07de8e..0eba46d1ed48850d5fb288de320bab45bcac836a 100644 (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
index a27af8c8511d601dd36b44e79557d5136cc5d1a9..e3e576ed12e320c5efce089e39d8e881d0a443d7 100644 (file)
@@ -27,4 +27,6 @@
   </tbody>
 </table>
 
-<%= pagination_links_full @role_pages %>
\ No newline at end of file
+<p><%= pagination_links_full @role_pages %></p>
+
+<p><%= link_to l(:label_permissions_report), :action => 'report' %></p>
diff --git a/app/views/roles/report.rhtml b/app/views/roles/report.rhtml
new file mode 100644 (file)
index 0000000..61e1e18
--- /dev/null
@@ -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 %>
\ No newline at end of file
index 024c71950c45ec48f027a098472311a68d4b7efc..254dec4d7f138f45fdacb3bca247994564df4f5c 100644 (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
index 07dea3cede2d073175123472cda33801b5b86497..3193e9c3d14774558b5d2c149589ad83f85c36e2 100644 (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
index 391cb085ee690742733a34404aa0c7daca0c5e00..393d473cf851b2d63ec290382c0c440c5d4a0670 100644 (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
index aeac0e72e040d7fca2c24857da53d717bfa9de4a..584c35dde7eda92c2c47b3b20b770918aa1d8191 100644 (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
index 4fc22aeedbf9eee611d796298a744cbdec7f93bc..a7379115e7be9eba9a72cc909d69260bba28dfaa 100644 (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
index 67f8b2be51d0ba69c0a6aa39daeeaa4aa9613853..710fef5aa8f03902dc5941a563189fe9f5929164 100644 (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: 変更
index 471039ec85a2fd9f026fd3f8e930410f487aee82..eede3868700b3b5a04d62ab8a860dc606b58bd23 100644 (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: 提交
index ada2b67cd02b1513c0c377286d45eed2785af5ae..7461c74a3bbb0cc90e9248a121963aa7ab20c492 100644 (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 *************/