File tree Expand file tree Collapse file tree 4 files changed +7
-16
lines changed
lib/core/app/models/concerns/ros Expand file tree Collapse file tree 4 files changed +7
-16
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ module ApplicationRecordConcern
55 extend ActiveSupport ::Concern
66 include AssociationResource
77 include UrnConcern
8- include Ros :: ScopableConcern
8+ include ScopableConcern
99
1010 class_methods do
1111 def account_id ; Apartment ::Tenant . current . eql? ( 'public' ) ? '' : Apartment ::Tenant . current . remove ( '_' ) end
Original file line number Diff line number Diff line change @@ -4,14 +4,9 @@ module Ros
44 module ScopableConcern
55 extend ActiveSupport ::Concern
66
7- class_methods do
8- def everything ( _user_context )
9- all
10- end
11-
12- def owned ( _user_context )
13- all
14- end
7+ included do
8+ scope :everything , -> ( _user_context ) { all }
9+ scope :owned , -> ( _user_context ) { all }
1510 end
1611 end
1712end
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ class User < Cognito::ApplicationRecord
66 has_many :user_pools
77 has_many :pools , through : :user_pools
88
9+ scope :owned , -> ( user_context ) { where ( id : user_context . cognito_user_id ) }
10+
911 def self . reset
1012 UserPool . delete_all
1113 Pool . delete_all
@@ -16,10 +18,6 @@ def self.file_fingerprint_attributes
1618 column_names + %i[ pool_name ]
1719 end
1820
19- def self . owned ( user_context )
20- where ( id : user_context . cognito_user_id )
21- end
22-
2321 # rubocop:disable Rails/Output
2422 def self . load_document ( file_name , column_map = nil , create = false )
2523 column_map ||= default_headers
Original file line number Diff line number Diff line change @@ -37,9 +37,7 @@ def self.urn_id; :username end
3737 authentication_keys : [ :username ]
3838 # jwt_revocation_strategy: Devise::JWT::RevocationStrategies::Null
3939
40- def self . owned ( user_context )
41- where ( id : user_context . iam_user . id )
42- end
40+ scope :owned , -> ( user_context ) { where ( id : user_context . iam_user . id ) }
4341
4442 def all_policy_actions
4543 # delete duplication and group by name, effect and segment
You can’t perform that action at this time.
0 commit comments