X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f107a5232d5e8788ae19daf1c5f6639f0c3cdb68..6177a6474c312d5d5b9c1f0eaa3ebd089a64b5f1:/apps/workbench/app/controllers/folders_controller.rb diff --git a/apps/workbench/app/controllers/folders_controller.rb b/apps/workbench/app/controllers/folders_controller.rb index 3f536fbea4..566b1a9da3 100644 --- a/apps/workbench/app/controllers/folders_controller.rb +++ b/apps/workbench/app/controllers/folders_controller.rb @@ -3,8 +3,38 @@ class FoldersController < ApplicationController Group end + def index_pane_list + %w(My_folders Shared_with_me) + end + def index - @objects = Group.where group_class: 'folder' + @my_folders = [] + @shared_with_me = [] + @objects = Group.where(group_class: 'folder').order('name') + owner_of = {} + moretodo = true + while moretodo + moretodo = false + @objects.each do |folder| + if !owner_of[folder.uuid] + moretodo = true + owner_of[folder.uuid] = folder.owner_uuid + end + if owner_of[folder.owner_uuid] + if owner_of[folder.uuid] != owner_of[folder.owner_uuid] + owner_of[folder.uuid] = owner_of[folder.owner_uuid] + moretodo = true + end + end + end + end + @objects.each do |folder| + if owner_of[folder.uuid] == current_user.uuid + @my_folders << folder + else + @shared_with_me << folder + end + end end def show