rename foreign uuid attributes
[arvados.git] / apps / workbench / app / controllers / groups_controller.rb
1 class GroupsController < ApplicationController
2   before_filter :ensure_current_user_is_admin
3
4   def index
5     @groups = Group.limit(10000).all
6     @group_uuids = @groups.collect &:uuid
7     @owned_users = User.where owner_uuid: @group_uuids
8     @links_from = Link.where link_class: 'permission', tail_uuid: @group_uuids
9     @links_to = Link.where link_class: 'permission', head_uuid: @group_uuids
10   end
11
12   def show
13     @collections = Collection.where(owner_uuid: @object.uuid)
14     @names = {}
15     @keep_flag = {}
16     @pgp_hu_id = {}
17     Link.
18       limit(10000).
19       where(head_uuid: @collections.collect(&:uuid)).
20       each do |link|
21       if link.properties[:name]
22         @names[link.head_uuid] ||= []
23         @names[link.head_uuid] << link.properties[:name]
24       end
25       if link.link_class == 'resources' and link.name == 'wants'
26         @keep_flag[link.head_uuid] = true
27       end
28       @pgp_hu_id[link.head_uuid] ||= link.properties[:pgp_hu_id]
29     end
30     @collections_total_bytes = @collections.collect(&:total_bytes).inject(0,&:+)
31     super
32   end
33 end