Account status is now part of the "notifications" area
[arvados.git] / apps / workbench / app / controllers / users_controller.rb
1 class UsersController < ApplicationController
2   skip_before_filter :find_object_by_uuid, :only => :welcome
3   skip_around_filter :thread_with_api_token, :only => :welcome
4   around_filter :thread_with_optional_api_token, :only => :welcome
5
6   def welcome
7     if current_user
8       redirect_to home_user_path(current_user.uuid)
9     end
10   end
11
12   def home
13     @showallalerts = false
14     @my_ssh_keys = AuthorizedKey.where(authorized_user_uuid: current_user.uuid)
15     # @my_vm_perms = Link.where(tail_uuid: current_user.uuid, head_kind: 'arvados#virtual_machine', link_class: 'permission', name: 'can_login')
16     # @my_repo_perms = Link.where(tail_uuid: current_user.uuid, head_kind: 'arvados#repository', link_class: 'permission', name: 'can_write')
17
18     @my_jobs = Job.
19       limit(10).
20       order('created_at desc').
21       where(created_by: current_user.uuid)
22
23     @my_collections = Collection.
24       limit(10).
25       order('created_at desc').
26       where(created_by: current_user.uuid)
27
28     @my_pipelines = PipelineInstance.
29       limit(10).
30       order('created_at desc').
31       where(created_by: current_user.uuid)
32
33
34     # A Tutorial is a Link which has link_class "resources" and name
35     # "wants", and is owned by the Tutorials Group (i.e., named
36     # "Arvados Tutorials" and owned by the system user).
37     @tutorial_group = Group.where(owner_uuid: User.system.uuid,
38                                   name: 'Arvados Tutorials').first
39     if @tutorial_group
40       @tutorial_links = Link.where(tail_uuid: @tutorial_group.uuid,
41                                    link_class: 'resources',
42                                    name: 'wants')
43     else
44       @tutorial_links = []
45     end
46     @tutorial_complete = {
47       'Run a job' => @my_last_job
48     }
49   end
50 end