X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b288ebe08b16204d97c4911106bd5ca57fb2b36b..b12f667daa270a4e3c656d16f30620ca763f9578:/services/api/app/controllers/arvados/v1/users_controller.rb?ds=sidebyside diff --git a/services/api/app/controllers/arvados/v1/users_controller.rb b/services/api/app/controllers/arvados/v1/users_controller.rb index f39a8830df..c2a32f02f1 100644 --- a/services/api/app/controllers/arvados/v1/users_controller.rb +++ b/services/api/app/controllers/arvados/v1/users_controller.rb @@ -60,22 +60,21 @@ class Arvados::V1::UsersController < ApplicationController raise ArgumentError.new "Cannot activate without being invited." end act_as_system_user do - required_uuids = Link.where(owner_uuid: system_user_uuid, - link_class: 'signature', - name: 'require', - tail_uuid: system_user_uuid, - head_kind: 'arvados#collection'). + required_uuids = Link.where("owner_uuid = ? and link_class = ? and name = ? and tail_uuid = ? and head_uuid like ?", + system_user_uuid, + 'signature', + 'require', + system_user_uuid, + Collection.uuid_like_pattern). collect(&:head_uuid) signed_uuids = Link.where(owner_uuid: system_user_uuid, link_class: 'signature', name: 'click', - tail_kind: 'arvados#user', tail_uuid: @object.uuid, - head_kind: 'arvados#collection', head_uuid: required_uuids). collect(&:head_uuid) todo_uuids = required_uuids - signed_uuids - if todo_uuids == [] + if todo_uuids.empty? @object.update_attributes is_active: true logger.info "User #{@object.uuid} activated" else @@ -136,7 +135,7 @@ class Arvados::V1::UsersController < ApplicationController UserNotifier.account_is_setup(@object).deliver end - render json: { kind: "arvados#HashList", items: @response } + render json: { kind: "arvados#HashList", items: @response.as_api_response(nil) } end # delete user agreements, vm, repository, login links; set state to inactive @@ -148,10 +147,10 @@ class Arvados::V1::UsersController < ApplicationController protected - def self._setup_requires_parameters + def self._setup_requires_parameters { send_notification_email: { type: 'boolean', required: true }, - } + } end end