rabarber 4.1.3 → 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,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "singleton"
4
-
5
- module Rabarber
6
- module Audit
7
- class Logger
8
- include Singleton
9
-
10
- attr_reader :logger
11
-
12
- def initialize
13
- @logger = ::Logger.new(Rails.root.join("log/rabarber_audit.log"))
14
- end
15
-
16
- def self.log(log_level, message)
17
- return unless Rabarber::Configuration.instance.audit_trail_enabled
18
-
19
- instance.logger.public_send(log_level, message)
20
- end
21
- end
22
- end
23
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Rabarber
4
- module Core
5
- class NullRoleable
6
- def roles(context:) # rubocop:disable Lint/UnusedMethodArgument
7
- []
8
- end
9
-
10
- def all_roles
11
- {}
12
- end
13
-
14
- def has_role?(*role_names, context: nil) # rubocop:disable Lint/UnusedMethodArgument
15
- false
16
- end
17
-
18
- def log_identity
19
- "Unauthenticated #{Rabarber::HasRoles.roleable_class.model_name.human.downcase}"
20
- end
21
- end
22
- end
23
- end
@@ -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