2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/api_maker/services/can_can/load_abilities.rb', line 2
def perform
result = []
request.each do |ability_data|
ability_data = ability_data.fetch(1) if ability_data.is_a?(Array)
ability = ability_data.fetch("ability")
subject = ability_data.fetch("subject")
subject_to_check = subject
subject_to_check = subject.model_class if subject.is_a?(Class) && subject < ApiMaker::BaseResource
can = current_ability.can?(ability.to_sym, subject_to_check)
result << {
ability: ability,
can: can,
subject: subject
}
end
succeed!(abilities: result)
end
|