1 class FoldersController < ApplicationController
7 %w(My_folders Shared_with_me)
12 item = ArvadosBase.find params[:item_uuid]
13 if (item.class == Link and
14 item.link_class == 'name' and
15 item.tail_uuid = @object.uuid)
16 # Given uuid is a name link, linking an object to this
17 # folder. First follow the link to find the item we're removing,
18 # then delete the link.
20 item = ArvadosBase.find link.head_uuid
21 @removed_uuids << link.uuid
24 if item.owner_uuid == @object.uuid
25 # Object is owned by this folder. Remove it from the folder by
26 # changing owner to the current user.
27 item.update_attributes owner_uuid: current_user
28 @removed_uuids << item.uuid
35 @objects = Group.where(group_class: 'folder').order('name')
40 @objects.each do |folder|
41 if !owner_of[folder.uuid]
43 owner_of[folder.uuid] = folder.owner_uuid
45 if owner_of[folder.owner_uuid]
46 if owner_of[folder.uuid] != owner_of[folder.owner_uuid]
47 owner_of[folder.uuid] = owner_of[folder.owner_uuid]
53 @objects.each do |folder|
54 if owner_of[folder.uuid] == current_user.uuid
57 @shared_with_me << folder
64 @objects = @object.contents include_linked: true
65 @share_links = Link.filter([['head_uuid', '=', @object.uuid],
66 ['link_class', '=', 'permission']])
67 @logs = Log.limit(10).filter([['object_uuid', '=', @object.uuid]])
69 @objects_and_names = []
70 @objects.each do |object|
71 if !(name_links = @objects.links_for(object, 'name')).empty?
72 name_links.each do |name_link|
73 @objects_and_names << [object, name_link]
76 @objects_and_names << [object,
77 Link.new(tail_uuid: @object.uuid,
78 head_uuid: object.uuid,
88 @new_resource_attrs = (params['folder'] || {}).merge(group_class: 'folder')
89 @new_resource_attrs[:name] ||= 'New folder'