class GroupsController < ApplicationController
before_filter :ensure_current_user_is_admin
+
+ def index
+ @groups = Group.limit(10000).all
+ @group_uuids = @groups.collect &:uuid
+ @owned_users = User.where owner: @group_uuids
+ @links_from = Link.where link_class: 'permission', tail_uuid: @group_uuids
+ @links_to = Link.where link_class: 'permission', head_uuid: @group_uuids
+ end
end
<% end %>
</tbody>
</table>
+<pre>
+<%= JSON.pretty_generate(@object.attributes) rescue nil %>
+</pre>
--- /dev/null
+<table class="table table-hover">
+ <thead>
+ <tr class="contain-align-left">
+ <th>
+ id
+ </th><th>
+ name
+ </th><th>
+ owner
+ </th><th>
+ incoming permissions
+ </th><th>
+ outgoing permissions
+ </th><th>
+ owned
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+
+ <% @groups.sort_by { |g| g[:created_at] }.reverse.each do |g| %>
+
+ <tr>
+ <td>
+ <%= link_to_if_orvos_object g %>
+ </td><td>
+ <%= g.name %>
+ </td><td>
+ <%= g.owner %>
+ </td><td>
+ <%= @links_to.select { |x| x.head_uuid == g.uuid }.collect(&:tail_uuid).uniq.count %>
+ </td><td>
+ <%= @links_from.select { |x| x.tail_uuid == g.uuid }.collect(&:head_uuid).uniq.count %>
+ </td><td>
+ <%= @owned_users.select { |x| x.owner == g.uuid }.count %> users<br />
+ </td>
+ </tr>
+
+ <% end %>
+
+ </tbody>
+</table>
-<table class="table table-condensed table-hover topalign">
- <thead>
- </thead>
- <tbody>
- <% @object.attributes_for_display.each do |attr, attrvalue| %>
- <%= render partial: 'application/orvos_object_attr', locals: { attr: attr, attrvalue: attrvalue } %>
- <% end %>
- </tbody>
-</table>
-<pre>
-<%= JSON.pretty_generate(@object.attributes) rescue nil %>
-</pre>
+<%= render :partial => 'application/orvos_object' %>
<% [
[true, 'Data', collections_path],
[true, 'FactoryJobs', factory_jobs_path],
+ [true, 'Groups', groups_path],
[true, 'Jobs', jobs_path]
].each do |admin_only, name, path| %>
<% if !admin_only or (current_user and current_user.is_admin) %>
</tbody>
</table>
<pre>
-<%= JSON.pretty_generate(@object.components) rescue nil %>
+<%= JSON.pretty_generate(@object.attributes) rescue nil %>
</pre>