Class: ActiveRecord::Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record_base.rb

Overview

add the __synchromesh_permission_granted, acting_user and __secure_collection_check methods to Relation

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#__synchromesh_permission_grantedObject

Returns the value of attribute __synchromesh_permission_granted.



40
41
42
# File 'lib/active_record_base.rb', line 40

def __synchromesh_permission_granted
  @__synchromesh_permission_granted
end

#acting_userObject

Returns the value of attribute acting_user.



41
42
43
# File 'lib/active_record_base.rb', line 41

def acting_user
  @acting_user
end

Instance Method Details

#__secure_collection_check(acting_user) ⇒ Object



42
43
44
45
46
47
# File 'lib/active_record_base.rb', line 42

def __secure_collection_check(acting_user)
  return self if __synchromesh_permission_granted
  return self if __secure_remote_access_to_all(self, acting_user).__synchromesh_permission_granted
  return self if __secure_remote_access_to_unscoped(self, acting_user).__synchromesh_permission_granted
  Hyperloop::InternalPolicy.raise_operation_access_violation(:scoped_permission_not_granted, "Last relation: #{self}, acting_user: #{acting_user}")
end