1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 module CommonApiTemplate
6 def self.included(base)
9 alias_method :as_api_response_orig, :as_api_response
10 include InstanceMethods
12 base.extend(ClassMethods)
13 base.api_accessible :common do |t|
20 t.add :modified_by_client_uuid
21 t.add :modified_by_user_uuid
26 module InstanceMethods
27 # choose template based on opts[:for_user]
28 def as_api_response(template=nil, opts={})
30 user = opts[:for_user] || current_user
31 if user.andand.is_admin and self.respond_to? :api_accessible_superuser
37 self.as_api_response_orig(template, opts)