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|
19 t.add :modified_by_user_uuid
24 module InstanceMethods
25 # choose template based on opts[:for_user]
26 def as_api_response(template=nil, opts={})
28 user = opts[:for_user] || current_user
29 if user.andand.is_admin and self.respond_to? :api_accessible_superuser
35 self.as_api_response_orig(template, opts)