summaryrefslogtreecommitdiffstats
path: root/app/views/roles
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-08-29 16:52:35 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-08-29 16:52:35 +0000
commit603e11d7a5aa62f923e7b013cac6c66462131232 (patch)
treefbbb204d2b92b5a87b787d56fe3f9c62cc3f259b /app/views/roles
parent8da5bad29516be6cbe1bc52e78837ac1ec292026 (diff)
downloadredmine-603e11d7a5aa62f923e7b013cac6c66462131232.tar.gz
redmine-603e11d7a5aa62f923e7b013cac6c66462131232.zip
Merged 0.6 branch into trunk.
Permissions management was rewritten. Some permissions can now be specifically defined for non member and anonymous users. This migration: * is irreversible (please, don't forget to *backup* your database before upgrading) * resets role's permissions (go to "Admin -> Roles & Permissions" to set them after upgrading) git-svn-id: http://redmine.rubyforge.org/svn/trunk@674 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/roles')
-rw-r--r--app/views/roles/_form.rhtml25
-rw-r--r--app/views/roles/list.rhtml6
-rw-r--r--app/views/roles/report.rhtml37
3 files changed, 33 insertions, 35 deletions
diff --git a/app/views/roles/_form.rhtml b/app/views/roles/_form.rhtml
index d69fff132..62e25e337 100644
--- a/app/views/roles/_form.rhtml
+++ b/app/views/roles/_form.rhtml
@@ -1,23 +1,20 @@
<%= error_messages_for 'role' %>
+
<div class="box">
-<!--[form:role]-->
-<p><%= f.text_field :name, :required => true %></p>
+<p><%= f.text_field :name, :required => true, :disabled => @role.builtin? %></p>
+</div>
<p><%= f.check_box :assignable %></p>
<div class="clear"></div>
-<h3><%=l(:label_permissions)%></h3>
-<% permissions = @permissions.group_by {|p| p.group_id } %>
-<% permissions.keys.sort.each do |group_id| %>
-<fieldset style="margin-top: 6px;"><legend><strong><%= l(Permission::GROUPS[group_id]) %></strong></legend>
-<% permissions[group_id].each do |p| %>
- <div style="width:170px;float:left;"><%= check_box_tag "permission_ids[]", p.id, (@role.permissions.include? p) %>
- <%= l(p.description.to_sym) %>
- </div>
+<fieldset class="box"><legend><%=l(:label_permissions)%></legend>
+<% @permissions.each do |permission| %>
+ <div style="width:220px;float:left;">
+ <%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
+ <%= permission.name.to_s.humanize %>
+ </div>
<% end %>
+<%= hidden_field_tag 'role[permissions][]', '' %>
<div class="clear"></div>
-</fieldset>
-<% end %>
<br />
<%= check_all_links 'role_form' %>
-<!--[eoform:role]-->
-</div>
+</fieldset>
diff --git a/app/views/roles/list.rhtml b/app/views/roles/list.rhtml
index e3e576ed1..14ae260aa 100644
--- a/app/views/roles/list.rhtml
+++ b/app/views/roles/list.rhtml
@@ -13,15 +13,17 @@
<tbody>
<% for role in @roles %>
<tr class="<%= cycle("odd", "even") %>">
- <td><%= link_to role.name, :action => 'edit', :id => role %></td>
+ <td><%= content_tag(role.builtin? ? 'em' : 'span', link_to(role.name, :action => 'edit', :id => role)) %></td>
<td align="center" style="width:15%;">
+ <% unless role.builtin? %>
<%= link_to image_tag('2uparrow.png', :alt => l(:label_sort_highest)), {:action => 'move', :id => role, :position => 'highest'}, :method => :post, :title => l(:label_sort_highest) %>
<%= link_to image_tag('1uparrow.png', :alt => l(:label_sort_higher)), {:action => 'move', :id => role, :position => 'higher'}, :method => :post, :title => l(:label_sort_higher) %> -
<%= link_to image_tag('1downarrow.png', :alt => l(:label_sort_lower)), {:action => 'move', :id => role, :position => 'lower'}, :method => :post, :title => l(:label_sort_lower) %>
<%= link_to image_tag('2downarrow.png', :alt => l(:label_sort_lowest)), {:action => 'move', :id => role, :position => 'lowest'}, :method => :post, :title => l(:label_sort_lowest) %>
+ <% end %>
</td>
<td align="center" style="width:10%;">
- <%= button_to l(:button_delete), { :action => 'destroy', :id => role }, :confirm => l(:text_are_you_sure), :class => "button-small" %>
+ <%= button_to(l(:button_delete), { :action => 'destroy', :id => role }, :confirm => l(:text_are_you_sure), :class => "button-small") unless role.builtin? %>
</tr>
<% end %>
</tbody>
diff --git a/app/views/roles/report.rhtml b/app/views/roles/report.rhtml
index 61e1e18e4..676e25f39 100644
--- a/app/views/roles/report.rhtml
+++ b/app/views/roles/report.rhtml
@@ -1,32 +1,31 @@
<h2><%=l(:label_permissions_report)%></h2>
<%= start_form_tag({:action => 'report'}, :id => 'permissions_form') %>
-
+<%= hidden_field_tag 'permissions[0]', '' %>
<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| %>
+<thead>
<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>
+ <th><%=l(:label_permissions)%></th>
<% @roles.each do |role| %>
- <td align="center"><%= check_box_tag "permission_ids[#{role.id}][]", p.id, (role.permissions.include? p) %></td>
+ <th><%= content_tag(role.builtin? ? 'em' : 'span', h(role.name)) %></th>
<% end %>
</tr>
+</thead>
+<tbody>
+<% @permissions.each do |permission| %>
+ <tr class="<%= cycle('odd', 'even') %>">
+ <td><%= permission.name.to_s.humanize %></td>
+ <% @roles.each do |role| %>
+ <td align="center">
+ <% if role.setable_permissions.include? permission %>
+ <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name) %>
<% end %>
-<% reset_cycle
-end %>
+ </td>
+ <% end %>
+ </tr>
+<% 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
+<%= end_form_tag %>