Class: Hyperloop::InternalPolicy

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.accessible_attributes_for(model, acting_user) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/reactive_record/permissions.rb', line 12

def self.accessible_attributes_for(model, acting_user)
  user_channels = ClassConnectionRegulation.connections_for(acting_user, false) +
    InstanceConnectionRegulation.connections_for(acting_user, false)
  internal_policy = InternalPolicy.new(model, model.attribute_names, user_channels)
  ChannelBroadcastRegulation.broadcast(internal_policy)
  InstanceBroadcastRegulation.broadcast(model, internal_policy)
  internal_policy.accessible_attributes_for
end

Instance Method Details

#accessible_attributes_forObject



21
22
23
24
25
26
27
28
# File 'lib/reactive_record/permissions.rb', line 21

def accessible_attributes_for
  accessible_attributes = Set.new
  @channel_sets.each do |channel, attribute_set|
    accessible_attributes.merge attribute_set
  end
  accessible_attributes << :id unless accessible_attributes.empty?
  accessible_attributes
end