Module: CommandTower::AdminScope::ApplyUsersNarrowing

Defined in:
lib/command_tower/admin_scope/apply_users_narrowing.rb

Class Method Summary collapse

Class Method Details

.call(relation:, scope_context:, principal:) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/command_tower/admin_scope/apply_users_narrowing.rb', line 8

def call(relation:, scope_context:, principal:)
  return relation if scope_context.nil?

  registration = CommandTower.config.admin_scope.fetch(scope_context.tool_id)
  registration.narrow_users.call(
    relation:,
    scope_value: scope_context.scope_value,
    principal:,
    tool_id: scope_context.tool_id
  )
end