rabarber 4.1.4 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Rabarber
4
- module Core
5
- class PermissionsIntegrityChecker
6
- attr_reader :controller
7
-
8
- def initialize(controller = nil)
9
- @controller = controller
10
- end
11
-
12
- def run!
13
- return if missing_list.empty?
14
-
15
- raise(
16
- Rabarber::Error,
17
- "Following actions were passed to 'grant_access' method but are not defined in the controller:\n#{missing_list.to_yaml}"
18
- )
19
- end
20
-
21
- private
22
-
23
- def missing_list
24
- @missing_list ||= action_rules.each_with_object([]) do |(controller, hash), arr|
25
- missing_actions = hash.keys - controller.action_methods.map(&:to_sym)
26
- arr << { controller => missing_actions } if missing_actions.any?
27
- end
28
- end
29
-
30
- def action_rules
31
- rules = Rabarber::Core::Permissions.action_rules
32
- controller ? rules.slice(controller) : rules
33
- end
34
- end
35
- end
36
- end