1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 require 'record_filters'
7 class ComputedPermission < ApplicationRecord
8 self.table_name = 'materialized_permissions'
9 include CurrentApiClient
10 include CommonApiTemplate
13 PERM_LEVEL_S = ['none', 'can_read', 'can_write', 'can_manage']
15 api_accessible :user do |t|
18 t.add :perm_level_s, as: :perm_level
24 PERM_LEVEL_S[perm_level]
27 def self.default_orders
28 ["#{table_name}.user_uuid", "#{table_name}.target_uuid"]
31 def self.readable_by(*args)
35 def self.searchable_columns(operator)
36 if !operator.match(/[<=>]/) && !operator.in?(['in', 'not in'])
39 ['user_uuid', 'target_uuid']
43 def self.limit_index_columns_read
47 def self.selectable_attributes
48 %w(user_uuid target_uuid perm_level)
51 def self.columns_for_attributes(select_attributes)
55 def self.serialized_attributes
59 def self.unique_columns