1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 class User < ArvadosBase
8 @attribute_sortkey['first_name'] = '050'
9 @attribute_sortkey['last_name'] = '051'
13 res = arvados_api_client.api self, '/current', nil, {}, false
14 arvados_api_client.unpack_api_response(res)
18 @@arvados_system_user ||= begin
19 res = arvados_api_client.api self, '/system'
20 arvados_api_client.unpack_api_response(res)
25 (self.first_name || "") + " " + (self.last_name || "")
29 self.private_reload(arvados_api_client.api(self.class,
30 "/#{self.uuid}/activate",
34 def contents params={}
35 Group.contents params.merge(uuid: self.uuid)
38 def attributes_for_display
39 super.reject { |k,v| %w(owner_uuid default_owner_uuid identity_url prefs).index k }
42 def attribute_editable?(attr, ever=nil)
43 (ever or not (self.uuid.andand.match(/000000000000000$/) and
44 self.is_admin)) and super
47 def friendly_link_name lookup=nil
48 [self.first_name, self.last_name].compact.join ' '
52 self.private_reload(arvados_api_client.api(self.class,
53 "/#{self.uuid}/unsetup",
58 arvados_api_client.api(self, "/setup", params)
61 def update_profile params
62 self.private_reload(arvados_api_client.api(self.class,
63 "/#{self.uuid}/profile",
72 current_user and current_user.is_admin