+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
class UsersController < ApplicationController
- skip_around_filter :require_thread_api_token, only: :welcome
- skip_before_filter :check_user_agreements, only: [:welcome, :inactive]
- skip_before_filter :check_user_profile, only: [:welcome, :inactive, :profile]
- skip_before_filter :find_object_by_uuid, only: [:welcome, :activity, :storage]
- before_filter :ensure_current_user_is_admin, only: [:sudo, :unsetup, :setup]
+ skip_around_action :require_thread_api_token, only: :welcome
+ skip_before_action :check_user_agreements, only: [:welcome, :inactive, :link_account, :merge]
+ skip_before_action :check_user_profile, only: [:welcome, :inactive, :profile, :link_account, :merge]
+ skip_before_action :find_object_by_uuid, only: [:welcome, :activity, :storage]
+ before_action :ensure_current_user_is_admin, only: [:sudo, :unsetup, :setup]
def show
if params[:uuid] == current_user.uuid
owner_uuid: @object.uuid
}
})
- redirect_to root_url(api_token: resp[:api_token])
+ redirect_to root_url(api_token: "v2/#{resp[:uuid]}/#{resp[:api_token]}")
end
def home
@my_jobs = Job.
limit(10).
order('created_at desc').
+ with_count('none').
where(created_by: current_user.uuid)
@my_collections = Collection.
limit(10).
order('created_at desc').
+ with_count('none').
where(created_by: current_user.uuid)
collection_uuids = @my_collections.collect &:uuid
@my_pipelines = PipelineInstance.
limit(10).
order('created_at desc').
+ with_count('none').
where(created_by: current_user.uuid)
respond_to do |f|
end
end
- def repositories
- # all repositories accessible by current user
- all_repositories = Hash[Repository.where(authorized_user_uuid: current_user.uuid).collect {|repo| [repo.uuid, repo]}]
-
- # repositories shared with the user
- repo_links = Link.
- filter([['head_uuid', 'is_a', 'arvados#repository'],
- ['tail_uuid', '=', current_user.uuid],
- ['link_class', '=', 'permission'],
- ])
-
- @my_repositories = [] # we want them ordered as owned, manageable, and the rest
- @repo_writable = {}
-
- # owned repos
- all_repositories.each do |_, repo|
- if repo.owner_uuid == current_user.uuid
- @repo_writable[repo.uuid] = 'can_write'
- @my_repositories << repo
- end
- end
-
- # shared and either writable or manageable
- handled = @my_repositories.map(&:uuid)
- repo_links.each do |link|
- if link.name.in? ['can_write', 'can_manage']
- @repo_writable[link.head_uuid] = link.name
- @my_repositories << all_repositories[link.head_uuid] if !link.head_uuid.in?(handled)
- end
- end
-
- # rest of the repos
- handled = @my_repositories.map(&:uuid)
- all_repositories.each do |_, repo|
- @my_repositories << repo if !repo.uuid.in?(handled)
- end
- end
-
def virtual_machines
@my_vm_logins = {}
Link.where(tail_uuid: @object.uuid,
RequestShellAccessReporter.send_request(current_user, params).deliver
end
+ def merge
+ User.merge params[:new_user_token], params[:direction]
+ redirect_to "/"
+ end
+
protected
def find_current_links user